Skip to content

Commit da90ddb

Browse files
committed
reference: improve lambda example
1 parent 912ab64 commit da90ddb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/doc/reference.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2970,10 +2970,8 @@ function argument, and call it with a lambda expression as an argument:
29702970

29712971
```
29722972
fn ten_times<F>(f: F) where F: Fn(i32) {
2973-
let mut i = 0i32;
2974-
while i < 10 {
2975-
f(i);
2976-
i += 1;
2973+
for index in 0..10 {
2974+
f(index);
29772975
}
29782976
}
29792977

0 commit comments

Comments
 (0)