2012-04-11 23:45:18 -05:00
|
|
|
fn main() {
|
|
|
|
let mut c = 0u;
|
2012-06-30 18:19:07 -05:00
|
|
|
for [1u, 2u, 3u, 4u, 5u]/_.eachi |i, v| {
|
2012-04-11 23:45:18 -05:00
|
|
|
assert (i + 1u) == v;
|
|
|
|
c += 1u;
|
|
|
|
}
|
|
|
|
assert c == 5u;
|
|
|
|
|
2012-06-30 18:19:07 -05:00
|
|
|
for none::<uint>.eachi |i, v| { fail; }
|
2012-04-11 23:45:18 -05:00
|
|
|
|
|
|
|
let mut c = 0u;
|
2012-06-30 18:19:07 -05:00
|
|
|
for some(1u).eachi |i, v| {
|
2012-04-11 23:45:18 -05:00
|
|
|
assert (i + 1u) == v;
|
|
|
|
c += 1u;
|
|
|
|
}
|
|
|
|
assert c == 1u;
|
|
|
|
|
2012-06-29 18:26:56 -05:00
|
|
|
}
|