The break and continue statements

It is often necessary to handle exception conditions within loops. The statements break and continue are used for this.

The break command terminates the execution of the innermost enclosing loop, causing execution to resume after the nearest done statement.

To exit from n levels, use the command:

   break n

This will cause execution to resume after the done n levels up.

The continue command causes execution to resume at the while, until or for statement which begins the loop containing the continue command.

You can also specify an argument n|FR to continue which will cause execution to continue at the n|FRth enclosing loop up.


[Home] [Search] [Index] This site maintained by unixhelp@hardrock.org