Exits from a WHILE loop.
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.
Consider the following code fragment:
while var1 > 20
.. some commands …
if var2 = 1
… more commands …
… still more commands …
… 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.