EXIT v15
The innermost loop is terminated, and the statement following END LOOP
is executed next.
If WHEN
is present, loop exit occurs only if the specified condition is TRUE
. Otherwise control passes to the statement after EXIT
.
You can use EXIT
to cause early exit from all types of loops, not just unconditional loops.
This example shows a loop that iterates 10 times and then uses the EXIT
statement to terminate:
The following is the output from this example: