Beginner
Swift
Q26 / 100
What does try? do in Swift?
Correct! Well done.
Incorrect.
The correct answer is B) Calls a throwing function and returns an optional — nil if an error is thrown
B
Correct Answer
Calls a throwing function and returns an optional — nil if an error is thrown
Explanation
let val = try? parse() returns Optional<T>. If parsing succeeds, val wraps the result; if it throws, val is nil.
Progress
26/100