In lisp, an operator ifaccepts three expressions that are a condition, a value if the condition is true and a value when the condition is false ... for example
(if (< x 0)
(print "x is negative")
(print "x is greater or equal than zero"))
You can also omit the last expression, in which case it is considered NIL.
If you want to add more expressions in one of two cases, you must wrap them in a form progn
(if (< x 0)
(progn
(print "HEY!!!!")
(print "The value of x is negative...")))
, if , , , :
(when (< x 0)
(do-this)
(do-that)
(do-even-that-other-thing))
(unless (< x 0)
(do-this)
(do-that)
(do-even-that-other-thing))
when, ,
(if (< x 0)
(progn
(do-this)
(do-that)
(do-even-that-other-thing)))
unless , ... ,
(if (not (< x 0))
(progn
(do-this)
(do-that)
(do-even-that-other-thing)))
, if , ( ). when unless , .
if progn , .