Beginner
Swift
Q11 / 100
What is an associated value in a Swift enum?
Correct! Well done.
Incorrect.
The correct answer is B) Additional data attached to an enum case: case .success(Int) or case .failure(Error)
B
Correct Answer
Additional data attached to an enum case: case .success(Int) or case .failure(Error)
Explanation
enum Result { case success(Int); case failure(Error) } stores specific data per case. Switch over it with case .success(let n): to extract the value.
Progress
11/100