XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

block


Type:   -   special form (fsubr)
Source:   -   xlcont.c

Syntax

(block name [body ... ])
name - an unevaluated symbol for the block name
body - a series of expressions
returns - the value of the last expression

Description

The 'block' special form specifies a 'named-block' construct. The last expression in 'body' will be returned by the 'block' construct as its result unless a return or return-from is executed within 'block'. The return exit will exit the nearest (inner-most) 'block'. The return-from exit will exit the specified 'block'.

Examples

(block out                        ; outer BLOCK
  (print "outer")
  (block in                       ; inner BLOCK
    (print "inner")
    (return-from out "all done")
    (print "won't get here")))    ; prints "outer"
                                  ; prints "inner"
                                  ; returns "all done"

See the block special form in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next