User Tools

Site Tools


ch2_1_when

WHEN

WHEN is a simple LISP macro built on IF. In LabLISP, WHEN is implemented as a special form. Accepts any number of arguments. The first argument - the condition - is evaluated and if it is true (not NIL), all the remaining forms are evaluated and result of the last one is returned, as in PROGN. If the condition is false, the rest is ignored and when returns NIL.

(when c f1 f2 f3)        ; syntax of WHEN
 
(if c (progn f1 f2 f3))  ; equivalent construction with IF

See also IF, PROGN, UNLESS, AND, OR

ch2_1_when.txt · Last modified: 2022/02/24 13:48 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki