XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

or


Type:   -   special form (fsubr)
Source:   -   xlcont.c

Syntax

(or [expr1 ... ])
exprN - an expression
returns - NIL if all expressions evaluate to NIL , otherwise the value of the first non-NIL expression
Note: evaluation of expressions stops after the first expression that does not evaluate to NIL

Description

The 'or' special form evaluates a sequence of expressions and returns the effect of a logical 'inclusive-or' operation on the expressions. If all of the expressions are NIL , NIL is returned as the result. Evaluation of the expressions will stop when an expression evaluates to something other than NIL , none of the subsequent expressions will be evaluated. If there are no expressions, 'or' returns NIL as its result.

Examples

(or NIL NIL NIL)                    ; returns NIL
(or NIL T NIL)                      ; returns T
(or NIL (princ "hi") (princ "ho"))  ; prints  hi  and returns "hi"
(or T T T)                          ; returns T
(or)                                ; returns NIL

(setq a 5)  (setq b 6)              ; set up A and B
(if (or (< a b) (< b a))            ; if
   (print "not equal")              ;   then
   (print "equal"))                 ;   else
                                    ; prints  "not equal"

See the or special form in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next