Special Form Entry: FOREACH
← Prev | ↑ Chapter | Next → | Index | Symbols
Special Form Entry: FOREACH
Name
foreach
Class
Special Form
Syntax
(foreach name list [expr ...])
Description
Iterates over each element of list, binding it to name.
Evaluation Rules
- evaluate
list - for each element of the resulting list, bind it to
name - evaluate the body forms in order
Return Values
Returns the final body value or nil if no body exists.
Side Effects
Side effects are those of:
- evaluation of
list, - rebinding
namefor each iteration, - evaluation of the body forms for each iteration.
Exceptional Situations
Erroneous if the list argument is not acceptable to the active host semantics.
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
- [foreach (AutoLISP)](https://help.autodesk.com/cloudhelp/2022/ENU/AutoCAD-AutoLISP-Reference/files/GUID-BE6A23C4-4E18-45A6-854E-2DE9574A6925.htm)
- Status: documented in core behavior; concise here.