about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2016-07-21 11:27:00 +0200
committerGitHub <noreply@github.com>2016-07-21 11:27:00 +0200
commit9ba1792aac8b01a313c87611a2525a87a6606bc3 (patch)
tree675165b252f24ae9108ba8c8b6d9236513080d75
parent705d92d42d5b829acf118e26ae9c0fc3c835ed14 (diff)
parent3b5d71e0cfb2d81f588a0b8929e796f3b68488e0 (diff)
downloadrust-9ba1792aac8b01a313c87611a2525a87a6606bc3.tar.gz
rust-9ba1792aac8b01a313c87611a2525a87a6606bc3.zip
Rollup merge of #34880 - xitep:master, r=steveklabnik
Make .enumerate() example self-explanatory

Should resolve #34624
-rw-r--r--src/doc/book/loops.md14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/doc/book/loops.md b/src/doc/book/loops.md
index e681d1bee06..e4cb861d3b0 100644
--- a/src/doc/book/loops.md
+++ b/src/doc/book/loops.md
@@ -105,19 +105,19 @@ When you need to keep track of how many times you already looped, you can use th
 #### On ranges:
 
 ```rust
-for (i, j) in (5..10).enumerate() {
-    println!("i = {} and j = {}", i, j);
+for (index, value) in (5..10).enumerate() {
+    println!("index = {} and value = {}", index, value);
 }
 ```
 
 Outputs:
 
 ```text
-i = 0 and j = 5
-i = 1 and j = 6
-i = 2 and j = 7
-i = 3 and j = 8
-i = 4 and j = 9
+index = 0 and value = 5
+index = 1 and value = 6
+index = 2 and value = 7
+index = 3 and value = 8
+index = 4 and value = 9
 ```
 
 Don't forget to add the parentheses around the range.