The 'cond' special form evaluates a series of
(cond ; sample CONDitional
((not T) (print "this won't print"))
( NIL (print "neither will this"))
( T (print "this will print"))
( T (print "won't get here"))) ; prints "this will print"
(defun print-what (parm)
(cond ; start of COND
((numberp parm) (print "numeric")) ; check for number
((consp parm) (print "list")) ; check for list
((null parm) (print "nil")) ; check for NIL
(T (print "something")))) ; catch-all
(print-what 'a) ; prints "something"
(print-what 12) ; prints "numeric"
(print-what NIL) ; prints "nil"
(print-what '(a b)) ; prints "list"
See the
cond
special form in the