Name

if

Usage

special-form/function

Syntax

(if test then-form [else-form])

Description

If test is true, returns the result of then-form, else returns the result of else-form or null. Truth is defined by the function boolean.

user 1 > (if (zero? 0)
               1
             2)
it: 1
user 2 > (if (zero? 1)
               1
             2)
it: 2
user 3 > (if (zero? 1)
             1)
it: null
user 4 > (map if '(true false true) '(1 2 3) '(a b c))
it: (1 b 3)
user 5 > (map if '(true false true) '(1 2 3))
it: (1 null 3)