9.0;next, revision 9.0, 85/03/27
NEXT -- Return to the top of a loop.
usage: NEXT
FORMAT
NEXT
NEXT interrupts the flow of control in a Shell loop construct (FOR, SELECT,
and WHILE). When NEXT is encountered in a FOR or WHILE loop, control passes
back to the top of the loop (see examples below). When NEXT is encountered in
a SELECT loop, control passes to the next CASE clause. (This is useful when
you have specified SELECT ONEOF but want to test multiple things under certain
circumstances).
You may terminate the flow of control in a loop by using the EXIT command.
Type HELP EXIT for more information.
The NEXT command requires no arguments or options.
EXAMPLES
Consider the following section from a Shell script:
n := 0
WHILE ((^n < 10))
DO READ -TYPE integer n
IF ((^n < 10)) THEN NEXT ENDIF
ARGS ^n
ENDDO
AS long as the READ command reads integers into variable "n" that are less
than 10, the NEXT command executes and causes the script to return to the top
of the WHILE loop. When the value of n is greater than or equal to 10, the
script prints the number then leaves the WHILE loop and continues execution.
For more information on variables, refer to the DOMAIN System User's Guide.
RELATED TOPICS
More information is available. Type:
- HELP 'FOR'
for information on FOR loops.
- HELP 'SELECT'
for information on SELECT loops.
- HELP 'WHILE'
for information on WHILE loops.