(if true (println “yes”) (println “no”)) prints yes nil But (if true “yes” “no”) prints yes
(if …) is an expression that returns the value of the matched branch.
In the first case there is a side effect (println “yes”) that prints “yes”. The overall expression then returns nil, which is printed by the repl.
In the second case, there is no side effect and the expression returns “yes” which is printed by the repl.
|You must be logged in to comment|