up previous next

Break

Syntax

Break
    

Summary

break out of a loop

Description

This command must be used inside a loop statement (For, Foreach, Repeat, or While). When executed, the current loop statement is terminated and control passes to the command following the loop statement. Thus, in the case of nested loops Break does *not* break out of all loops back to the top level (see Return).

example

    
For I := 5 To 1 Step -1 Do
  For J := 1 To 100 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