Clojure: Boolean

By Xah Lee. Date: . Last updated: .

Boolean Literals

The following are builtin literals.

Clojure nil is Java's null.

false and nil are false, everything else evaluates to true in true/false context.

(if nil 1 2) ; 2

Logic Functions

;; boolean and
(and true false) ; false

;; boolean or
(or true false) ; true

;; boolean not
(not true) ; false