Purpose | The break statement is used to terminate the execution of a loop. | |
Format |
break;
|
|
Example #1 |
for (x = 0; x < 10; x = x + 1) { if (x = 5) { break; }; } The loop executes until x equals 5 when the loop is terminated by the break statement. |