mirror of
https://github.com/rust-lang/rust
synced 2024-09-05 08:37:14 +00:00
Fix off by one in the iterator documentation
`(1..100).map(|x| x + 1)` is actually mapping [1,100) to [2,101)
This commit is contained in:
parent
243e85f393
commit
4425422bdd
|
@ -259,7 +259,7 @@ a new iterator. The simplest one is called `map`:
|
|||
|
||||
`map` is called upon another iterator, and produces a new iterator where each
|
||||
element reference has the closure it's been given as an argument called on it.
|
||||
So this would give us the numbers from `2-100`. Well, almost! If you
|
||||
So this would give us the numbers from `2-101`. Well, almost! If you
|
||||
compile the example, you'll get a warning:
|
||||
|
||||
```text
|
||||
|
|
Loading…
Reference in a new issue