06 Feb 2014, 20:38
Generic-user-small

Arun Sharma (1 post)

(if true (println “yes”) (println “no”)) prints yes nil But (if true “yes” “no”) prints yes

10 Apr 2015, 14:12
Alex_head_pragsmall

Alex Miller (8 posts)

(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