mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 20:14:32 -06:00
Merge pull request #553 from shepmaster/no-inclusive-range
Inclusive ranges are not stable, don't tell people to use them
This commit is contained in:
@@ -14,10 +14,9 @@ Now that you know more Rust, we can talk in detail about how this works.
|
|||||||
Ranges (the `0..10`) are 'iterators'. An iterator is something that we can
|
Ranges (the `0..10`) are 'iterators'. An iterator is something that we can
|
||||||
call the `.next()` method on repeatedly, and it gives us a sequence of things.
|
call the `.next()` method on repeatedly, and it gives us a sequence of things.
|
||||||
|
|
||||||
(By the way, a range with two dots like `0..10` is inclusive on the left (so it
|
A range with two dots like `0..10` is inclusive on the left (so it
|
||||||
starts at 0) and exclusive on the right (so it ends at 9). A mathematician
|
starts at 0) and exclusive on the right (so it ends at 9). A mathematician
|
||||||
would write "[0, 10)". To get a range that goes all the way up to 10 you can
|
would write "[0, 10)".
|
||||||
write `0...10`.)
|
|
||||||
|
|
||||||
Like this:
|
Like this:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user