up previous next
break out of a loop
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
).
/**/ 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
|