CONTINUE v15
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 begins, 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 reevaluated.
If you use the WHEN
clause, then the next iteration of the loop begins only if the specified expression in the WHEN
clause evaluates to TRUE
. Otherwise, control is passed to the statement following the CONTINUE
statement.
You can use the CONTINUE
statement only inside a loop.
This example uses the CONTINUE
statement to skip the display of the odd numbers:
The following is the output from this example: