BREAK Verb - Exit Loop
Syntax
BREAK
Description
The BREAK verb exits from REPEAT .. UNTIL, WHILE .. WEND, or FOR .. NEXT loops and terminates a CASE in a SWITCH. The terminating command for the current loop or SWITCH is located by sequentially searching the program from the location of the BREAK and keeping a count of similar looping constructs until the terminating command is located. Execution continues immediately after the terminating command.
Examples
Example1
The following uses BREAK in a SWITCH .. CASE .. SWEND construction:
1010 SWITCH EVENT
1020 CASE 1
1030 LET FIELD=FIELD+1; BREAK
1040 CASE 2
1050 LET FIELD=FIELD-1; BREAK
1060 CASE 0
1070 FIELD=-1
1080 SWEND
Example2
The following uses BREAK in a FOR .. NEXT loop:
4000 FOR X=1 TO 1000; IF ARRAY[X] BREAK ELSE NEXT X