Break keyword
The break keyword is used to exit a code block, loop or if statement early. If provided with a label, it can exit multiple nested blocks of code at the same time.
When breaking out of a block, if statement, or do-while loop, any expressions left on the stack will be used as the control flow item's expression result. Support for while and for loops has not yet been implemented. There are examples of this below.
Examples
The break statement can be used to break out of a block, loop or if statement:
By default, break statements jump out of the innermost loop. Where more complicated control flow is necessary, you can add labels to various blocks and loops, and then provide the label you wish to exit out of to the break statement. This is particularly useful for nested loops:
Code blocks can yield expressions. To pass these expressions to the break keyword, simply place them before it. To make something an expression, just don't end the line with a semicolon.