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

13 lines
216 B
Rust
Raw Normal View History

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