rust/src/test/run-pass/if-check.rs

26 lines
273 B
Rust
Raw Normal View History

2011-06-15 18:23:17 -05:00
// xfail-stage0
pred even(uint x) -> bool {
if (x < 2u) {
ret false;
}
else if (x == 2u) {
ret true;
}
else {
ret even(x - 2u);
}
}
fn foo(uint x) -> () {
if check(even(x)) {
2011-06-15 18:23:17 -05:00
log x;
}
else {
fail;
}
}
fn main() {
foo(2u);
}