We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ea9938 commit d0f1908Copy full SHA for d0f1908
src/control-flow/for-expressions.md
@@ -10,7 +10,19 @@ fn main() {
10
for x in v {
11
println!("x: {x}");
12
}
13
+
14
+ for i in (0..10).step_by(2) {
15
+ println!("i: {i}");
16
+ }
17
18
```
19
20
You can use `break` and `continue` here as usual.
21
22
+<details>
23
24
+* Index iteration is not a special syntax in Rust for just that case.
25
+* `(0..10)` is a range that implements an `Iterator` trait.
26
+* `step_by` is a method that returns another `Iterator` that skips every other element.
27
28
+</details>
0 commit comments