File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ for (x = 0; x < 10; x++) {
18
18
Instead, it looks like this:
19
19
20
20
``` {rust}
21
- for x in range(0, 10) {
21
+ for x in 0..10 {
22
22
println!("{}", x); // x: i32
23
23
}
24
24
```
@@ -38,7 +38,7 @@ valid for the loop body. Once the body is over, the next value is fetched from
38
38
the iterator, and we loop another time. When there are no more values, the
39
39
` for ` loop is over.
40
40
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,
42
42
and gives an iterator over those values. The upper bound is exclusive, though,
43
43
so our loop will print ` 0 ` through ` 9 ` , not ` 10 ` .
44
44
@@ -123,7 +123,7 @@ We now loop forever with `loop` and use `break` to break out early.
123
123
iteration. This will only print the odd numbers:
124
124
125
125
``` {rust}
126
- for x in range(0, 10) {
126
+ for x in 0..10 {
127
127
if x % 2 == 0 { continue; }
128
128
129
129
println!("{}", x);
You can’t perform that action at this time.
0 commit comments