2.4.10 The LEAVE Instruction
LEAVE [ symbol ] ;
This statement terminates the innermost, active loop. If symbol is
specified, it terminates the innermost, active loop having symbol
as control variable. As for scope, syntax, errors, and
functionality, it is identical to ITERATE, except that LEAVE
terminates the loop, while ITERATE lets the loop start on the next
iteration normal iteration. No actions normally associated with
the normal end of an iteration of a loop is performed for a LEAVE
instruction.
Example: Iterating a simple DO/END
In order to circumvent this, a simple DO/END can be rewritten as
this:
if foo then do until 1
say ‘This is a simple DO/END group’
say ‘but it can be terminated by’
leave
say ‘iterate or leave’
end
This shows how ITERATE has been used to terminate what for all
practical purposes is a simple DO/END group. Either ITERATE or
LEAVE can be used for this purpose, although LEAVE is perhaps
marginally faster.
PREV NEXT