Skip to content

Commit 93609ab

Browse files
committed
update original
1 parent e77f35a commit 93609ab

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

rust-by-example/src/flow_control/for.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ fn main() {
4646
}
4747
```
4848

49+
Just remember that even though you can compile the code when a>b, the loop gets
50+
never executed.
51+
```rust,editable
52+
for i in 10..1{
53+
println!("fizzbuzz");
54+
}
55+
```
56+
If you want to count down, you need to use .rev() instead
57+
```rust,editable
58+
for i in (1..10).rev(){
59+
println!("fizzbuzz");
60+
}
61+
```
4962
## for and iterators
5063

5164
The `for in` construct is able to interact with an `Iterator` in several ways.

rust-by-example/src/variable_bindings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ fn main() {
1616
// copy `an_integer` into `copied_integer`
1717
let copied_integer = an_integer;
1818
19-
println!("An integer: {:?}", copied_integer);
20-
println!("A boolean: {:?}", a_boolean);
19+
println!("An integer: {}", copied_integer);
20+
println!("A boolean: {}", a_boolean);
2121
println!("Meet the unit value: {:?}", unit);
2222
2323
// The compiler warns about unused variable bindings; these warnings can

0 commit comments

Comments
 (0)