We saw recently the for loop , and found that its structure was as follows:
for (start, end; increase)
What happens if we no beginning or end? Then we get an infinite loop, like this:
for (;;)
And how do you stop? For a break, like this:
for (;;)
{
break;
}
And this for me to use? For the idea is to repeat the instructions until the user wants to, ie:
I do not think I had mentioned that if within an if condition is only one instruction is not necessary to put keys, and also applies to the cycles.
If the user does not enter a 'y', the program never stops. Then we will see that the properties of aninfinite loop is very similar to the while loop to be discussed later.
0 comments:
Post a Comment