A Boolean is a concrete type that has two values, called true and false. These values represent logical truth values and are used in conditionals.

Dunaj (and Clojure) performs an automatic coercion to Boolean when e.g. calling a function that expects a boolean argument. By definition, nil and false coerce to false, any other value coerces to true.

In Dunaj lite, the type name clashes with host class java.lang.Boolean. Because of this, Dunaj provides type alias called Boolean+, that can be used in place of Boolean.
JVM host specific: Dunaj supports primitive booleans as function arguments and return values (subject to the number of arguments and combination of argument types). Note that this feature is not available in Dunaj lite.

JVM host specific: false is identical to Boolean/FALSE, so using other instances of java.lang.Boolean may lead to surprising results. In such cases, you may want to use boolean function, which coerces into correct boolean value.

1
2
3
4
5
(if (java.lang.Boolean. false) :is-true :is-false)
;;=> :is-true

(if (boolean (java.lang.Boolean. false)) :is-true :is-false)
;;=> :is-false

Boolean type, constructor, predicates and other related functionalities are defined in dunaj.boolean namespace.

Boolean has a dedicated syntax in CLJ.

JSON EDN CLJ

true literal

true

true

true

false literal

false

false

false