Truthiness

When testing the truth of an expression, Clojure considers the values nil and false to be false and everything else to be true. Here are some examples:

Reference: Truthiness

(if "anything other than nil or false is considered true"
  "A string is considered true"
  "A string is not considered true")
(if nil
  "nil is considered true"
  "nil is not considered true")
(if (get {:a 1} :b)
  "expressions which evaluate to nil are considered true"
  "expressions which evaluate to nil are not considered true")

results matching ""

    No results matching ""