2011-06-15 13:19:50 -05:00
|
|
|
|
|
|
|
|
2011-10-21 06:14:28 -05:00
|
|
|
fn pairs(it: block((int, int))) {
|
2011-07-27 07:19:39 -05:00
|
|
|
let i: int = 0;
|
|
|
|
let j: int = 0;
|
2011-10-21 06:14:28 -05:00
|
|
|
while i < 10 { it((i, j)); i += 1; j += i; }
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 07:19:39 -05:00
|
|
|
let i: int = 10;
|
|
|
|
let j: int = 0;
|
2011-10-21 06:14:28 -05:00
|
|
|
pairs() {|p|
|
|
|
|
let (_0, _1) = p;
|
|
|
|
log _0;
|
|
|
|
log _1;
|
|
|
|
assert (_0 + 10 == i);
|
2011-06-15 13:19:50 -05:00
|
|
|
i += 1;
|
2011-10-21 06:14:28 -05:00
|
|
|
j = _1;
|
|
|
|
};
|
2011-06-15 13:19:50 -05:00
|
|
|
assert (j == 45);
|
2011-08-15 23:54:52 -05:00
|
|
|
}
|