When 语句后跟一个TEST子句,其计算结果为t或nil。
(when (test-clause) (<action1) )
when - 示例
创建一个名为main.lisp的新源代码文件,并在其中键入以下代码。
(setq a 100) (when (> a 20) (format t "~% a is greater than 20")) (format t "~% value of a is ~d " a)
单击执行按钮或键入Ctrl+E时,LISP会立即执行它,并且返回的结果为-
a is greater than 20 value of a is 100