CoCoA:Break

From ApCoCoAWiki
Revision as of 10:02, 24 October 2007 by XMLBot (talk | contribs) (pushing XML rev. 1.46, again)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Break

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, <quotes> </quotes>;
      If J = I Then PrintLn; Break; EndIf;
    EndFor;
  EndFor;
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

-------------------------------

Syntax

Break

Return

   <type>loops</type>