Skip to content

Commit 88cf0b9

Browse files
committed
Guide: Adapt range values to variable name
1 parent d44ea72 commit 88cf0b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/doc/guide.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4326,7 +4326,7 @@ The most common consumer is `collect()`. This code doesn't quite compile,
43264326
but it shows the intention:
43274327

43284328
```{rust,ignore}
4329-
let one_to_one_hundred = range(0i, 100i).collect();
4329+
let one_to_one_hundred = range(1i, 101i).collect();
43304330
```
43314331

43324332
As you can see, we call `collect()` on our iterator. `collect()` takes
@@ -4336,7 +4336,7 @@ type of things you want to collect, and so you need to let it know.
43364336
Here's the version that does compile:
43374337

43384338
```{rust}
4339-
let one_to_one_hundred = range(0i, 100i).collect::<Vec<int>>();
4339+
let one_to_one_hundred = range(1i, 101i).collect::<Vec<int>>();
43404340
```
43414341

43424342
If you remember, the `::<>` syntax allows us to give a type hint,

0 commit comments

Comments
 (0)