mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
auto merge of #18139 : JelteF/rust-1/patch-1, r=steveklabnik
The explanation of fold talks about three elements that should be summed, but it uses different values in the provided code.
This commit is contained in:
commit
c121cbab35
@ -4363,7 +4363,7 @@ element, `find` returns an `Option` rather than the element itself.
|
||||
Another important consumer is `fold`. Here's what it looks like:
|
||||
|
||||
```{rust}
|
||||
let sum = range(1i, 100i)
|
||||
let sum = range(1i, 4i)
|
||||
.fold(0i, |sum, x| sum + x);
|
||||
```
|
||||
|
||||
@ -4387,7 +4387,7 @@ in this iterator:
|
||||
We called `fold()` with these arguments:
|
||||
|
||||
```{rust}
|
||||
# range(1i, 5i)
|
||||
# range(1i, 4i)
|
||||
.fold(0i, |sum, x| sum + x);
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user