Discuss this page

or

See or at Xelerus

Syntax (or exp1 [exp2 … expn]) → value/Nil
Arguments exp1: An expression that evaluates to Nil or something else
[exp2 … expn] Additional expressions to be evaluated
Category logical operator
Returns The value of the first expression that does not return Nil, or Nil if there is none. If there is only one argument, returns the value of that argument.
Description Uses lazy evaluation, which means that it stops after it finds a non-Nil value or ends up evaluating every argument if all of them return Nil

Example

(or 1 2 3 4 5 (setq foo 6))

Return 1. Also, foo will not be set to 6.

(or Nil (eq (setq foo "bar") "baz") "qux")

Returns “qux”. Also, foo will be set to “bar”

	(errblock (error b)
		(setq b (or c 0))
		b
		)

If c has not been bound anything, then this code will return the error No binding for symbol [c] ### (or c 0) ### since errors are not Nil. Beware of bad code when using errBlock, as or will simply evaluate the thrown errors as true

Return to Functions list