From 06e4b709c389c674e55326f50faf7ac308abe8c1 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Wed, 2 Dec 2015 14:15:46 -0500 Subject: [PATCH] Clarify that a for loop uses `IntoIterator` --- src/doc/book/loops.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/doc/book/loops.md b/src/doc/book/loops.md index 72e803d04f87..3e12e86da23f 100644 --- a/src/doc/book/loops.md +++ b/src/doc/book/loops.md @@ -80,13 +80,15 @@ for var in expression { } ``` -The expression is an [iterator][iterator]. The iterator gives back a series of -elements. Each element is one iteration of the loop. That value is then bound -to the name `var`, which is valid for the loop body. Once the body is over, the -next value is fetched from the iterator, and we loop another time. When there -are no more values, the `for` loop is over. +The expression is an item can can be converted into an [iterator] using +[`IntoIterator`]. The iterator gives back a series of elements. Each element is +one iteration of the loop. That value is then bound to the name `var`, which is +valid for the loop body. Once the body is over, the next value is fetched from +the iterator, and we loop another time. When there are no more values, the `for` +loop is over. [iterator]: iterators.html +[`IntoIterator`]: ../std/iter/trait.IntoIterator.html In our example, `0..10` is an expression that takes a start and an end position, and gives an iterator over those values. The upper bound is exclusive, though,