A falsy
value is a value that is considered false when encountered in a boolean context (i.e. if...else).
In JavaScript, there are 8 types of falsy values. This is from MDN.
In Clojure, it's dead simple. Everything except false
and nil
is true
in the boolean context.
(if nil
"NIL IS TRUTHY"
"NIL IS FALSY")
;; "NIL IS FALSY"
Isn't that nice? No more guess work :)
Warmly,
DH
Top comments (0)