Skip to content

Commit aa0e35b

Browse files
committed
2 parents 428d814 + ba769d8 commit aa0e35b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/libcore/iter.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,19 @@ pub struct Range<A> {
19621962
one: A
19631963
}
19641964

1965-
/// Return an iterator over the range [start, stop)
1965+
/// Returns an iterator over the given range [start, stop) (that is, starting
1966+
/// at start (inclusive), and ending at stop (exclusive)).
1967+
///
1968+
/// # Example
1969+
///
1970+
/// ```rust
1971+
/// let array = [0, 1, 2, 3, 4];
1972+
///
1973+
/// for i in range(0, 5u) {
1974+
/// println!("{}", i);
1975+
/// assert_eq!(i, array[i]);
1976+
/// }
1977+
/// ```
19661978
#[inline]
19671979
pub fn range<A: Add<A, A> + PartialOrd + Clone + One>(start: A, stop: A) -> Range<A> {
19681980
Range{state: start, stop: stop, one: One::one()}

0 commit comments

Comments
 (0)