Function num::iter::range [] [src]

pub fn range<A>(start: A, stop: A) -> Range<A> where A: Add<A, Output=A> + PartialOrd + Clone + One

Returns an iterator over the given range [start, stop) (that is, starting at start (inclusive), and ending at stop (exclusive)).

Example

extern crate num; fn main() { use num::iter; let array = [0, 1, 2, 3, 4]; for i in iter::range(0, 5) { println!("{}", i); assert_eq!(i, array[i]); } }
use num::iter;

let array = [0, 1, 2, 3, 4];

for i in iter::range(0, 5) {
    println!("{}", i);
    assert_eq!(i,  array[i]);
}