type: special form (fsubr) location: built-in source file: xlcont.c Common LISP compatible: yes supported on: all machines
(return-from <name> [ <expr> ] ) <name> - an unevaluated symbol for the block name <expr> - an expression
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".
(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