The break keyword is a part of switch statement and an optional part of looping for , do-while and while statements.
The break keyword terminates the smallest enclosing do, for, switch, or
while statement in which it appears.
The break statement is used to exit an iteration or switch statement. It transfers control to the statement immediately following the iteration substatement or switch statement.
The break statement terminates only the most tightly enclosing loop or switch statement. In loops, break is used to terminate before the termination criteria evaluate to 0. In the switch statement, break is used to terminate sections of code — normally before a case label. The following example illustrates the use of the break statement in a for loop:
i = 0;
while ( i < 10 )
// break at step 5
if( i == 5 )
printf("Step " + i );
For an example of using the break statement within the body of a switch
statement, see The switch Statement.