up previous next
break

break out of a loop command

Syntax
break

Description
This command must be used inside a loop statement ( for , foreach , repeat , or while ). When executed, the entire current loop statement is terminated, and control passes to the command following the loop statement. If you just want to skip to the next iteration of the current loop statement use continue .

In the case of nested loops break leaves just the innermost loop statement.

Example
/**/  for i := 5 to 1 step -1 do
/**/    for j := 1 to 10 do
/**/      print j, " ";
/**/      if j = i then println; break; endif;
/**/    endfor;
/**/  endfor;
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

See Also