about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTshepang Lekhonkhobe <tshepang@gmail.com>2015-07-05 14:49:08 +0200
committerTshepang Lekhonkhobe <tshepang@gmail.com>2015-07-05 14:49:08 +0200
commitda90ddb5fdf3a565d64695b27d57043332d69946 (patch)
tree4d24f2ed00c562b47a66b1e1e83bc59a251f17ae /src
parent912ab64a0de2c121a1c9f10bb1dbe75983b78c73 (diff)
downloadrust-da90ddb5fdf3a565d64695b27d57043332d69946.tar.gz
rust-da90ddb5fdf3a565d64695b27d57043332d69946.zip
reference: improve lambda example
Diffstat (limited to 'src')
-rw-r--r--src/doc/reference.md6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index a3e13acccae..bdd1e98fd6c 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -2970,10 +2970,8 @@ function argument, and call it with a lambda expression as an argument:
 
 ```
 fn ten_times<F>(f: F) where F: Fn(i32) {
-    let mut i = 0i32;
-    while i < 10 {
-        f(i);
-        i += 1;
+    for index in 0..10 {
+        f(index);
     }
 }