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

17 lines
309 B
Rust
Raw Normal View History

2010-06-23 21:03:09 -07:00
// -*- rust -*-
2010-06-23 21:03:09 -07:00
fn main() {
let mut sum: int = 0;
2012-06-30 16:19:07 -07:00
do first_ten |i| { #debug("main"); log(debug, i); sum = sum + i; }
#debug("sum");
log(debug, sum);
assert (sum == 45);
2010-06-23 21:03:09 -07:00
}
2012-01-23 14:59:00 -08:00
fn first_ten(it: fn(int)) {
let mut i: int = 0;
while i < 10 { #debug("first_ten"); it(i); i = i + 1; }
}