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 > (if (zero? 0)
             1
           2)
it: 1
user > (if (zero? 1)
             1
           2)
it: 2
user > (if (zero? 1)
           1)
it: null
user > (map if '(true false true) '(1 2 3) '(a b c))
it: (1 b 3)
user > (map if '(true false true) '(1 2 3))
it: (1 null 3)