fix wording

This commit is contained in:
Rod Elias 2021-01-11 23:04:21 -03:00 committed by GitHub
parent 773f02d4af
commit a943d122bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.