Conditional structure (I)
(if logical_expression do_statement )
Using progn, the single do_statement can be replaced by a block of statements:
(if logical_expression (progn do_statements ) )
Examples
(if (< 0 1.5) "yes") |
"yes" |
(if (= 2.5 3.5) "yes") |
nil |
(defun test_if (input) (if (= input 0) (progn (princ "First, do this.\n") (princ "Then, do that.") (princ) ) ) )
(test_if 0) |
|
(test_if 1) |
This website has been archived and is no longer maintained.