2010-07-22 14:11:39 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2011-10-21 06:14:28 -05:00
|
|
|
fn range(a: int, b: int, it: block(int)) {
|
2011-06-15 13:19:50 -05:00
|
|
|
assert (a < b);
|
2011-07-27 07:19:39 -05:00
|
|
|
let i: int = a;
|
2011-10-21 06:14:28 -05:00
|
|
|
while i < b { it(i); i += 1; }
|
2010-07-22 14:11:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 07:19:39 -05:00
|
|
|
let sum: int = 0;
|
2011-10-21 07:12:12 -05:00
|
|
|
range(0, 100) {|x| sum += x; }
|
2011-12-22 16:42:52 -06:00
|
|
|
log_full(core::debug, sum);
|
2011-08-15 23:54:52 -05:00
|
|
|
}
|