BREAK (Loops)

BREAK (Loops)

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

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.

See Also

CONTINUE

GOTO

WHILE

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish