-
Notifications
You must be signed in to change notification settings - Fork 4
Turtle Kitty edited this page Aug 9, 2015
·
2 revisions
This is the primitive conditional. It accepts expressions for a predicate, a consequent, and an alternative. If the predicate evaluates to true, the consequent is executed; otherwise, the alternative is executed.
If will send the to-bool message to any object given as a predicate.
(if true 'foo 'bar) -> foo
(if false 'foo 'bar) -> bar
(if 1 'foo 'bar) -> foo
(if 0 'foo 'bar) -> barr
(if "sexy" 'foo 'bar) -> foo
(if "" 'foo 'bar) -> bar
(if (list 5) 'foo 'bar) -> foo
(if () 'foo 'bar) -> bar