exists
operator
The non-associating, unary postfix exists
operator is used to test its operand for
nullness.
Usage
void m(Integer? num) {
Boolean haveNum = num exists;
}
Description
Definition
The meaning of exists
is defined as follows:
if (exists lhs) true else false
Polymorphism
The exists
operator is not polymorphic.
Type
The result type of the exists
operator is Boolean
.
Note
Do not to confuse the exists
operator described here and which
takes postfix form attribute exists
with the
exists
condition used in if
, assert
and
while
statements and which takes the prefix form
exists attribute
.
See also
-
exists
in the language specification. - operator precedence in the language specification