rust/src/test/run-pass/foreach-simple-outer-slot.rs

17 lines
273 B
Rust
Raw Normal View History

2010-06-23 23:03:09 -05:00
// -*- rust -*-
2010-06-23 23:03:09 -05:00
fn main() {
2011-07-27 07:19:39 -05:00
let sum: int = 0;
first_ten {|i| log "main"; log i; sum = sum + i; };
log "sum";
log sum;
assert (sum == 45);
2010-06-23 23:03:09 -05:00
}
fn first_ten(it: block(int)) {
2011-07-27 07:19:39 -05:00
let i: int = 0;
while i < 10 { log "first_ten"; it(i); i = i + 1; }
}