next up previous
Contents Next: read (FUNCTION) Up: Appendix: Selected LISP Previous: numberp (PREDICATE)

or (MACRO)

Format: (or <exp1> <exp2> ... <expn>)

Required arguments: None

This macro evaluates arguments in order until it reaches a non-nil value, in which case it returns that value, or it returns nil. Evaluation of intermediate expressions may produce side-effects. In the special case where and is given no arguments, it always returns nil.

Examples:

>(or 3 (+ 4 5))
3

>(or nil (print 'hello))

HELLO 
HELLO

>(or nil '(print hello) 3)
(PRINT HELLO)

>(or)
NIL



© Colin Allen & Maneesh Dhagat
November 1999