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