18.6.7 continue
The continue statement moves the control to the starting position of the nearest do, for, or while loop that encloses this statement. Typically, the continue statement is used to return the control to the loop starting position from a deep nesting level.
- Organization of this subsection
(1) Format
- Jump statement
continue;
(2) Description
The following shows the rules to determine where the next repetition starts for the do, for, or while statement when the continue statement is encountered.
-
The next repetition is started by reevaluation of expressions in the do or while statement inside it.
-
When the continue statement is specified in the for statement, the condition expression in the for statement is reevaluated. The result of reevaluation determines whether to exit or repeat the main part of the statement.
You should not specify more than 255 continue statements in a loop structure.
(3) Example of coding
for (count=1;count<=10;count=count+1) if (count < 5) continue; endif; ... next;
In the above example, the codes following the continue statement are skipped until the value of count reaches 5.