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++) {
1818Instead, 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
3838the 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,
4242and gives an iterator over those values. The upper bound is exclusive, though,
4343so 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.
123123iteration. 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);
You can’t perform that action at this time.
0 commit comments