rust/src/test/run-pass/iter-range.rs

18 lines
218 B
Rust
Raw Normal View History

iter range(int a, int b) -> int {
assert (a < b);
let int i = a;
while (i < b) {
put i;
i += 1;
}
}
fn main() {
let int sum = 0;
for each (int x in range(0, 100)) {
sum += x;
}
log sum;
}