type: special form (fsubr) location: built-in source file: xlcont.c Common LISP compatible: yes supported on: all machines
(prog2 [ <expr1> <expr2> ... ] ) <exprN> - expressions comprising the body of the loop
The PROG2 special form is basically a 'block' construct (like a PASCAL BEGIN / END) that contains a block of code (expressions) to evaluate. <expr2>'s value will be returned as the result of PROG2. If there is no <expr2>, <expr1> is returned. If there is no <expr1>, NIL is returned.
(prog2 (print "hi") (print "ho")) ; prints "hi" "ho" returns "ho" (prog2) ; returns NIL (prog2 (print "hi")) ; prints "hi" returns "hi" (prog2 (print "ho") "hey") ; prints "ho" returns "hey" (prog2 'a 'b 'c) ; returns B
NOTE: PROG1, PROG2, PROGN and PROGV do not allow the use of RETURN or GO or tags for GO.