rust/src/test/run-pass/foreach-put-structured.rs
2010-06-23 21:03:09 -07:00

22 lines
339 B
Rust

iter pairs() -> tup(int,int) {
let int i = 0;
let int j = 0;
while (i < 10) {
put tup(i, j);
i += 1;
j += i;
}
}
fn main() {
let int i = 10;
let int j = 0;
for each (tup(int,int) p in pairs()) {
log p._0;
log p._1;
check (p._0 + 10 == i);
i += 1;
j = p._1;
}
check(j == 45);
}