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 e843487 commit ea3385cCopy full SHA for ea3385c
src/flow_control/for.md
@@ -26,6 +26,26 @@ fn main() {
26
}
27
```
28
29
+Alternatively, `a..=b` can be used for a range that is inclusive on both ends.
30
+The above can be written as:
31
+
32
+```rust,editable
33
+fn main() {
34
+ // `n` will take the values: 1, 2, ..., 100 in each iteration
35
+ for n in 1..=100 {
36
+ if n % 15 == 0 {
37
+ println!("fizzbuzz");
38
+ } else if n % 3 == 0 {
39
+ println!("fizz");
40
+ } else if n % 5 == 0 {
41
+ println!("buzz");
42
+ } else {
43
+ println!("{}", n);
44
+ }
45
46
+}
47
+```
48
49
## for and iterators
50
51
The `for in` construct is able to interact with an `Iterator` in several ways.
0 commit comments