mirror of
https://github.com/Dhghomon/easy_rust
synced 2024-11-17 15:29:51 +00:00
fix wording
This commit is contained in:
parent
773f02d4af
commit
a943d122bf
@ -6329,7 +6329,7 @@ Err("No CEO found for Stark Enterprises")
|
||||
```
|
||||
|
||||
|
||||
`.and_then()` is a helpful message that takes an `Option`, then lets you do something to its value and pass it on. So its input is an `Option`, and its output is also an `Option`. It is sort of like a safe "unwrap, then do something, then wrap again".
|
||||
`.and_then()` is a helpful method that takes an `Option`, then lets you do something to its value and pass it on. So its input is an `Option`, and its output is also an `Option`. It is sort of like a safe "unwrap, then do something, then wrap again".
|
||||
|
||||
An easy example is a number that we get from a vec using `.get()`, because that returns an `Option`. Now we can pass it to `and_then()`, and do some math on it if it is `Some`. If it is `None`, then the `None` just gets passed through.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user