NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
The break statement

Within loops (such as a while loop) you can use the break statement to exit the loop immediately.

It only exits out of the innermost loop


The break statement is also a critical component of most switch statements. It prevents code in subsequent code sections from being executed, which is usually a programmer's intent, by immediately exiting the switch statement. Missing break statements in a switch are a frequent source of hard-to-find bugs.

Here is an example of how to use the break statement:

while (x<100) {
x = get_new_x();
if (button_pressed())