break

Availability

Flash Player 4.

Usage

break

Parameters

None.

Returns

Nothing.

Description

Statement; appears within a loop (for, for..in, do while or while) or within a block of statements associated with a particular case within a switch action. The break action instructs Flash to skip the rest of the loop body, stop the looping action, and execute the statement following the loop statement. When using the break action, the Flash interpreter skips the rest of the statements in that case block and jumps to the first statement following the enclosing switch action. Use the break action to break out of a series of nested loops.

Example

The following example uses the break action to exit an otherwise infinite loop.

i = 0;
while (true) {
  if (i >= 100) {
    break;
  }
  i++;
}

See also

break, for, for..in, do while, while, switch, case