Beginner Swift
Q9 / 100

What is the nil-coalescing operator ?? in Swift?

Correct! Well done.

Incorrect.

The correct answer is B) Returns the wrapped optional value if non-nil; otherwise returns the right-hand default

B

Correct Answer

Returns the wrapped optional value if non-nil; otherwise returns the right-hand default

Explanation

let name = optName ?? "Anonymous" returns optName's value if not nil, otherwise "Anonymous".

Progress
9/100