Booleans
Boolean values are constructed using the true
and false
keywords, as well as
through operators and methods that return booleans. For example, 20 > 10
returns a boolean true
value.
For boolean values, the logical conjunction a && b
, logical disjunction
a || b
, and logical negation !a
operators are available.
Logical conjunction has a higher precedence than disjunction: a && b || c && d
means (a && b) || (c && d)
.
Boolean values are primarily useful for branching statements that direct code execution based on the truthfulness of a condition.