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
(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