2010-06-23 21:03:09 -07:00
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
|
|
|
|
|
|
|
|
// -*- rust -*-
|
2010-06-23 21:03:09 -07:00
|
|
|
fn main() {
|
2012-03-22 08:39:41 -07:00
|
|
|
let mut sum: int = 0;
|
2012-06-26 13:55:56 -07:00
|
|
|
do first_ten {|i| #debug("main"); log(debug, i); sum = sum + i; }
|
2011-12-22 14:42:52 -08:00
|
|
|
#debug("sum");
|
2011-12-22 17:53:53 -08:00
|
|
|
log(debug, sum);
|
2011-06-15 11:19:50 -07:00
|
|
|
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)) {
|
2012-03-22 08:39:41 -07:00
|
|
|
let mut i: int = 0;
|
2011-12-22 14:42:52 -08:00
|
|
|
while i < 10 { #debug("first_ten"); it(i); i = i + 1; }
|
2011-08-15 21:54:52 -07:00
|
|
|
}
|