On this page
Class Boolean.Boolean
Boolean
(equivalent to Java's boolean
primitive type) is a subtype of scala.AnyVal. Instances of Boolean
are not represented by an object in the underlying runtime system.
There is an implicit conversion from scala.Boolean => scala.runtime.RichBoolean which provides useful non-primitive operations.
Supertypes |
---|
Abstract methods
Source
Compares two Boolean expressions and returns true
if they evaluate to a different value.
a != b
returns true
if and only if - a
is true
and b
is false
or - a
is false
and b
is true
.
Source
Compares two Boolean expressions and returns true
if both of them evaluate to true.
a & b
returns true
if and only if - a
and b
are true
.
Note | This method evaluates both |
---|
Source
Compares two Boolean expressions and returns true
if both of them evaluate to true.
a && b
returns true
if and only if - a
and b
are true
.
Note | This method uses 'short-circuit' evaluation and behaves as if it was declared as |
---|
Source
Compares two Boolean expressions and returns true
if they evaluate to the same value.
a == b
returns true
if and only if - a
and b
are true
or - a
and b
are false
.
Source
Compares two Boolean expressions and returns true
if they evaluate to a different value.
a ^ b
returns
true if and only if -
a is
true and
b is
false or -
a is
false and
b is
true.
Source
Negates a Boolean expression.
- !a
results in false
if and only if a
evaluates to true
and - !a
results in true
if and only if a
evaluates to false
.
Returns | the negated expression |
---|
Source
Compares two Boolean expressions and returns true
if one or both of them evaluate to true.
a | b
returns true
if and only if - a
is true
or - b
is true
or - a
and b
are true
.
Note | This method evaluates both |
---|
Source
Compares two Boolean expressions and returns true
if one or both of them evaluate to true.
a || b
returns true
if and only if - a
is true
or - b
is true
or - a
and b
are true
.
Note | This method uses 'short-circuit' evaluation and behaves as if it was declared as |
---|
© 2002-2022 EPFL, with contributions from Lightbend.
Licensed under the Apache License, Version 2.0.
https://scala-lang.org/api/3.2.0/scala/Boolean.html