BREAK (Loops)
Exits from a WHILE loop.
Syntax
BREAK
Comments
Upon encountering a BREAK command, the software continues execution at the first command following the ENDWHILE of the “innermost WHILE loop” containing the BREAK.
Any IF or CASE statements that are still open when a BREAK command is executed are automatically closed.
Example
Consider the following code fragment:
while var1 > 20
.. some commands …
if var2 = 1
break
else
… more commands …
endif
… still more commands …
endwhile
… commands after the WHILE loop …
When var2 is set to 1, the only commands executed in the above sequence are “some commands” and “commands after the WHILE loop”. Commands between the BREAK and ENDWHILE commands are ignored, and the “open” IF statement is automatically closed.