if
Evaluates a statement
(if cond yesBlock noBlock?)Description
Evaluates cond and if true calls yesBock otherwise calls noBlock
Body
cond - condition to be tested
yesBlock - block evaluated if cond true
noBlock? (optional) - block evaluated if cond false
Examples
(if (> 3 2) "yes" "no")
;;=> yes
(def var1 "aaa")
(if (= var1 "name") ;; condition
(print "Var & name equal") ;; yes
(print "not equal") ;; no
)
;;=> "not equal"
(if (and (> 2 3) (= 2 2))
(print "Yess")
)
Was this helpful?