When 语句后跟一个TEST子句,其计算结果为t或nil。
(when (test-clause) (<action1) )
创建一个名为main.lisp的新源代码文件,并在其中键入以下代码。
链接:https://www.learnfk.comhttps://www.learnfk.com/lisp/lisp-when-construct.html
来源:LearnFk无涯教程网
(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
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)