A break expression causes an immediate exit from the innermost enclosing while, for, or foreach expression loop. Control passes to the expression following the terminated loop.
In the following example, an if condition is placed in the while loop to check whether the current value is equal to “Display data for 2”. If true, the break executes and stops the loop from continuing.