Replies: 1 comment
-
// using map to add one
result.map(Ok(1), fn(x) { x + 1 }) // Ok(2)
// if the map returns a result, we get nested results
result.map(Ok(1), fn(x) { Ok(x + 1) }) // Ok(Ok(2))
// we can use try to avoid this nesting
result.try(Ok(1), fn(x) { Ok(x + 1) }) // Ok(2) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm reading the language tour and the description of these two read almost identical, what's the difference?
Beta Was this translation helpful? Give feedback.
All reactions