The 'return' special form allows the return of an arbitrary value at
arbitrary times within 'block' constructs like
If 'return' is used without being within a valid 'block' construct, an error is generated:
error: no target for RETURN
(prog (i) ; PROG form
(print i) (RETURN "foo") (print j)) ; prints NIL returns "foo"
(dotimes (i 10)
(if (eql i 5) (RETURN 20)
(princ i))) ; prints 01234 returns 20
(prog1 (print "hi") (RETURN "foo")) ; prints "hi"
; error: no target for RETURN
(return 9) ; error: no target for RETURN
See the
return
special form in the