about summary refs log tree commit diff
path: root/src/doc/tutorial.md
diff options
context:
space:
mode:
authorEduard Bopp <eduard.bopp@aepsil0n.de>2014-02-10 22:33:09 +0100
committerEduard Bopp <eduard.bopp@aepsil0n.de>2014-02-10 22:33:09 +0100
commitfbadb36c2bb53c40299744ff2c5cbc032a1ea7c7 (patch)
tree079896c7f6000807fd0498f9a311c0de419a4168 /src/doc/tutorial.md
parent838c62bb288d0fa6b395a9807ad8a519406e48c3 (diff)
downloadrust-fbadb36c2bb53c40299744ff2c5cbc032a1ea7c7.tar.gz
rust-fbadb36c2bb53c40299744ff2c5cbc032a1ea7c7.zip
Document for-loop in tutorial section on loops
Diffstat (limited to 'src/doc/tutorial.md')
-rw-r--r--src/doc/tutorial.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md
index 73fec54fbcb..a7e1b2b64c6 100644
--- a/src/doc/tutorial.md
+++ b/src/doc/tutorial.md
@@ -582,6 +582,18 @@ loop {
 This code prints out a weird sequence of numbers and stops as soon as
 it finds one that can be divided by five.
 
+There is also a for-loop that can be used to iterate over a range of numbers
+(or, more generally, anything implementing the `Iterator` trait):
+
+~~~~
+for n in range(0, 5) {
+    println!("{}", n);
+}
+~~~~
+
+The snippet above prints integer numbers under 5 starting at 0.
+
+
 # Data structures
 
 ## Structs