The nil-coalescing operator a ?? b
, unwraps an optional a if it contains a value, and returns b if it is nil
. a
must always be an optional type, and b
must be the same type as the type stored in a
.
It is shorthand for the following:
a != nil ? a! : b