The continue keyword is an optional part of for , do-while and while statements.
It stops the current iteration of a loop, and starts a new iteration.
continue;
You can use the continue statement only inside a while, do...while, or for
loop. Executing the continue statement stops the current iteration of the
loop and continues program flow with the beginning of the loop.
This has the following effects on the different types of loops:
while and do...while loops test their condition, and if true, execute the
loop again.
for loops execute their increment expression, and if the test expression
is true, execute the loop again.
The following example illustrates the use of the continue statement:
i = 0;
while ( i < 10 )
{
i++;
// Skip 5
if(
i == 5 )
{
continue;
}
printf("Step " +
i );
}