Special Form Entry: OR

← Prev | ↑ Chapter | Next → | Index | Symbols

Special Form Entry: OR

Name

or

Class

Special Form

Syntax

(or [expr ...])

Description

Tests expressions sequentially and returns T if any is non-nil, otherwise nil.

Evaluation Rules

Short-circuits on the first non-nil result.

Return Values

Returns T or nil.

Side Effects

Side effects are those of the expressions evaluated up to and including the first non-nil expression, or of all expressions if all are nil.

Expressions not reached because of short-circuiting are not evaluated and have no side effects.

Compatibility

This differs from Common Lisp or, which returns the first non-nil value. AutoLISP or returns only T or nil. Confirmed against BricsCAD V26 by direct citation: the BricsCAD V26 or reference page documents the return as "T if any provided argument evaluates as non-NIL; if all provided arguments evaluate as NIL, or if no argument is provided, NIL is returned" with examples (or 123 nil) -> T. Idioms ported from Common Lisp such as (setq x (or x default)) clobber x with T rather than preserving the existing value; portable AutoLISP code must use (if (not x) (setq x default)) instead.

Availability

  • AutoCAD 2026: documented (per Autodesk reference page).
  • BricsCAD V26: documented (BricsCAD V26 dedicated per-symbol page, return: "T if any provided argument evaluates as non-NIL; … NIL otherwise").
  • Status: documented in both vendors. Phase-5 closure: behaviour confirmed identical (T / nil only) across both vendors; surfaced as a real cross-vendor and cross-language hazard for code ported from Common Lisp.

See Also

  • probe-core.lsp — uses an if-guarded init pattern explicitly because AutoLISP's or does not return the first non-nil value (the original (setq x (or x default)) idiom was discovered to clobber x with T against BricsCAD V26 during Phase 5).

Source Notes