Complementing null-safe field access, the null coalescing operator ??
allows specifying a default/fallback value if a given expression is null
.
value ?? "fallback"
This roughly the same as:
value != null ? value : "fallback"
However, value
is not evaluated twice.