rust/src/test/run-pass/iter-range.rs
2012-07-01 19:19:32 -07:00

14 lines
219 B
Rust

fn range(a: int, b: int, it: fn(int)) {
assert (a < b);
let mut i: int = a;
while i < b { it(i); i += 1; }
}
fn main() {
let mut sum: int = 0;
range(0, 100, |x| sum += x );
log(debug, sum);
}