Beginner Swift
Q8 / 100

What does guard let do?

Correct! Well done.

Incorrect.

The correct answer is B) Unwraps an optional and exits the current scope with return/break/throw if nil

B

Correct Answer

Unwraps an optional and exits the current scope with return/break/throw if nil

Explanation

guard let x = optX else { return } unwraps optX and makes x available in the rest of the function. It reduces nesting vs if-let chains.

Progress
8/100