Next: , Previous: Recursion Tutorial, Up: Tutorial


3.21 Leaving definitions or loops

EXIT exits the current definition right away. For every counted loop that is left in this way, an UNLOOP has to be performed before the EXIT:

     : ...
      ... u+do
        ... if
          ... unloop exit
        endif
        ...
      loop
      ... ;

LEAVE leaves the innermost counted loop right away:

     : ...
      ... u+do
        ... if
          ... leave
        endif
        ...
      loop
      ... ;

Reference: Calls and returns, Counted Loops.