Special Form Entry: COND
← Prev | ↑ Chapter | Next → | Index | Symbols
Special Form Entry: COND
Name
cond
Class
Special Form
Syntax
(cond [(test result ...) ...])
Arguments and Values
- each clause contains a test and zero or more result forms
Description
Sequentially selects the first successful clause.
Evaluation Rules
- tests are evaluated in order
- when a test yields non-nil:
- if result forms exist, they are evaluated sequentially and the last value is returned
- otherwise the test value itself is returned
Return Values
- the selected clause value
- nil if no clause succeeds
Side Effects
Side effects arise from:
- evaluation of each test expression up to and including the first successful one,
- evaluation of the result forms of the selected clause, if any.
No later clause is evaluated after a successful clause is found.
Exceptional Situations
Malformed clause structure is erroneous.
Examples
(cond ((> 2 1) 'YES) (T 'NO)) => YES
Compatibility
Stable across vendors.
Notes
T may be used in the last clause as an always-true test.
Availability
- AutoCAD 2026: documented (per Autodesk reference page).
- BricsCAD V26: presumed compatible (no contradicting page found).
- Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.
Source Notes
- [cond (AutoLISP)](https://help.autodesk.com/cloudhelp/2018/ENU/AutoCAD-AutoLISP-Reference/files/GUID-7BA45202-D95F-4F2D-8D83-965024826074.htm)
- Status: documented.