Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

return-from

return-from

type: special form (fsubr)
location: built-in
source file: xlcont.c
Common LISP compatible: yes
supported on: all machines

SYNTAX

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

DESCRIPTION

The RETURN-FROM special form allows the return of an arbitrary value at arbitrary times within a 'named-block' construct (BLOCK) 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 


Go to the first, previous, next, last section, table of contents.