fork(1) download
  1. (if (= (+ 2 2) 4)
  2. (println "Maths works!") ; this gets evaluated if 2 + 2 = 4
  3. (println "UH OH")) ; this gets evaluated if 2 + 2 != 4
  4.  
  5. ;; Uncomment this and you'll get an error.
  6. ;(if (= (+ 2 2) 4)
  7. ; (println "Maths works!")
  8. ; (println "Maths still works!")
  9. ; (println "UH OH"))
  10.  
  11. (if (= (+ 2 2) 4)
  12. (do ; all of this gets evaluated if 2 + 2 = 4
  13. (println "Maths works!")
  14. (println "Maths still works!"))
  15. (println "UH OH"))
  16.  
  17. (def does-maths-work (if (= (+ 2 2) 4) "Maths works!" "UH OH"))
  18.  
  19. (println does-maths-work)
Success #stdin #stdout 1.66s 335552KB
stdin
Standard input is empty
stdout
Maths works!
Maths works!
Maths still works!
Maths works!