Skip to content

Commit f72c719

Browse files
committed
Merge pull request #20930 from charmeleon/master
Switching out range(0,10) example to 0..10. Tests fine Reviewed-by: brson
2 parents 268e2bf + 217cb6f commit f72c719

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/doc/trpl/looping.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ for (x = 0; x < 10; x++) {
1818
Instead, it looks like this:
1919

2020
```{rust}
21-
for x in range(0, 10) {
21+
for x in 0..10 {
2222
println!("{}", x); // x: i32
2323
}
2424
```
@@ -38,7 +38,7 @@ valid for the loop body. Once the body is over, the next value is fetched from
3838
the iterator, and we loop another time. When there are no more values, the
3939
`for` loop is over.
4040

41-
In our example, `range` is a function that takes a start and an end position,
41+
In our example, `0..10` is an expression that takes a start and an end position,
4242
and gives an iterator over those values. The upper bound is exclusive, though,
4343
so our loop will print `0` through `9`, not `10`.
4444

@@ -123,7 +123,7 @@ We now loop forever with `loop` and use `break` to break out early.
123123
iteration. This will only print the odd numbers:
124124

125125
```{rust}
126-
for x in range(0, 10) {
126+
for x in 0..10 {
127127
if x % 2 == 0 { continue; }
128128
129129
println!("{}", x);

0 commit comments

Comments
 (0)