Intermediate Swift
Q57 / 100

What is the difference between throwing and returning Result?

Correct! Well done.

Incorrect.

The correct answer is B) Throwing is for synchronous error propagation; Result is useful when storing or passing errors as values, especially in async contexts

B

Correct Answer

Throwing is for synchronous error propagation; Result is useful when storing or passing errors as values, especially in async contexts

Explanation

do-try-catch works well for synchronous code. Result<T, E> is useful when the outcome needs to be stored, passed in closures, or the caller controls when to handle it.

Progress
57/100