CONTINUE v11
The CONTINUE
statement provides a way to proceed with the next iteration of a loop while skipping intervening statements.
When the CONTINUE
statement is encountered, the next iteration of the innermost loop is begun, skipping all statements following the CONTINUE
statement until the end of the loop. That is, control is passed back to the loop control expression, if any, and the body of the loop is re-evaluated.
If the WHEN
clause is used, then the next iteration of the loop is begun only if the specified expression in the WHEN
clause evaluates to TRUE
. Otherwise, control is passed to the next statement following the CONTINUE
statement.
The CONTINUE
statement may not be used outside of a loop.
The following is a variation of the previous example that uses the CONTINUE
statement to skip the display of the odd numbers.
The following is the output from above program.