Table of contents
1. ( condition ? expr1 : expr2)
:
The conditional operator evaluates the condition and returns one of two expressions based on whether the condition is true or false.
If the condition is true,
expr1
is evaluated and returned; otherwise,expr2
is evaluated and returned.
2. (expr1 ?? expr2)
: (null aware)
- The null-aware conditional operator evaluates
expr1
. Ifexpr1
is non-null, its value is returned; otherwise,expr2
is evaluated and returned.