Selective structure
(cond (logical_expression_1 do_statement_1) (logical_expression_2 do_statement_2) ... (t do_statement_n) )
Examples
(cond ((= 1 2) "yes") (t "no")) |
"no" |
(defun test_cond (input) (cond ((= input 0) (princ "Zero\n")) ((= input 1) (princ "One\n")) ((= input 2) (princ "Two\n")) (t (princ "Everything else.\n")) ) )
(test_cond 0) |
|
(test_cond 1) |
|
(test_cond -1) |
This website has been archived and is no longer maintained.