2011-06-15 13:19:50 -05:00
|
|
|
|
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
iter pairs() -> rec(int _0, int _1) {
|
2011-06-15 13:19:50 -05:00
|
|
|
let int i = 0;
|
|
|
|
let int j = 0;
|
2011-07-26 07:49:40 -05:00
|
|
|
while (i < 10) { put rec(_0=i, _1=j); i += 1; j += i; }
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2011-06-15 13:19:50 -05:00
|
|
|
let int i = 10;
|
|
|
|
let int j = 0;
|
2011-07-26 07:49:40 -05:00
|
|
|
for each (rec(int _0, int _1) p in pairs()) {
|
2011-06-15 13:19:50 -05:00
|
|
|
log p._0;
|
|
|
|
log p._1;
|
|
|
|
assert (p._0 + 10 == i);
|
|
|
|
i += 1;
|
|
|
|
j = p._1;
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|
2011-06-15 13:19:50 -05:00
|
|
|
assert (j == 45);
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|