Contents Up << >>

Exit statements

The exit statement is used to complete the execution of a loop. The syntax of the exit statement is
exit-statement :
  EXIT [ label ] [ WHEN condition ] ";"
If the WHEN part is not included, the exit statement unconditionally exits the execution of a loop statement. If it does appear, then the execution is only completed if the boolean expression condition evaluates to true. Otherwise, execution will continue with the next statement. If the label appears, it names the loop statement to which the exit applies. If it does not appear, then the exit applies to the immediately enclosing loop statement.