break Statements

break statements terminate loop, switch, or label statements.

When using break with a while, do...while, for, or switch statement, break terminates the innermost enclosing loop or switch immediately and transfers control to the following statement.

When using break within an enclosing label statement, it terminates the statement and transfers control to the following statement. If a label is specified when the break is issued, the break statement terminates the specified statement.

break statement syntax:break or break [label]

Example—Iteration through array elements until the index of an element with the value of theValue is found:

for (i = 0; i < a.length; i++) {
  if (a[i] = theValue);
    break;
}