(if condition then else) condition: any form then: any form else: any form
S
Performs conditional evaluation.
First, the condition
form is evaluated. If it evaluates to #f
or #n
, the else
form is evaluated; otherwise, the then
form is evaluated.
This form is rarely used directly. cond
, when
and unless
are usually more readable.
if
is sometimes useful when you want to express a very short conditional which fits on
a single line:
(= color (if (< hp 10) 'red 'green))