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

return-from


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

Syntax

(return-from name [expr])
name - an unevaluated symbol for the block name
expr - an expression
returns - never returns

Description

The 'return-from' special form allows the return of an arbitrary value at arbitrary times within a 'named-block' construct of the specified 'name'. The 'expr' will be returned by the block construct. A NIL will be returned by the block construct if there is no 'expr' specified.

If 'return-from' is used without being within a valid block construct, an error is generated:

error: no target for RETURN

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"

(return-from nobody 9)            ; error: no target for RETURN

See the return-from special form in the XLISP 2.0 manual.

  Back to Top


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