map and flatMap on Result
Chaining transformations on success values without nested switch statements.
Welcome
`map` and `flatMap` on `Result` let you transform success values without nested switch statements, keeping your code flat and readable.
map on Result
```swift
let r: Result = .success(5)
let doubled = r.map { $0 * 2 } // .success(10)
let failed: Result = .failure(MyError.bad)
let same = failed.map { $0 * 2 } // .failure(MyError.bad)
```
All lessons in this course
- Result Fundamentals
- map and flatMap on Result
- Custom Error Types with LocalizedError
- Bridging Result to async/await