type: special form (fsubr) location: built-in source file: xlcont.c Common LISP compatible: yes supported on: all machines
(and [ <expr1> ... ] ) <exprN> - an expression
The AND special form evaluates a sequence of expressions and returns the effect of a logical AND on the expressions. If, at any point, an expression is NIL, NIL is returned as AND's result. If all of the expressions have a non-NIL value, the last expression's value is returned as the result. Evaluation of the expressions will stop when an expression evaluates to NIL, none of the subsequent expressions will be evaluated. If there are no expressions, AND returns T as its result.
(and T "boo" "hiss" T "rah") ; returns "rah" (and T T T T) ; returns T (and) ; returns T (and (princ "hi") NIL (princ "ho")) ; prints hi and returns NIL (and (princ "hi") (princ " de ") ; prints hi de ho (princ "ho")) ; returns "ho" (setq a 5) (setq b 6) ; set up A and B (if (and (numberp a) ; if A is a number (numberp b) ; and B is a number (< a b) ) ; and A<B (print "A is less than B") ; THEN do this (print "something else happened")) ; ELSE do this ; prints "A is less than B"