rust/src/test/run-fail/if-check-fail.rs
2012-08-01 19:16:06 -07:00

17 lines
307 B
Rust

// error-pattern:Number is odd
pure fn even(x: uint) -> bool {
if x < 2u {
return false;
} else if x == 2u { return true; } else { return even(x - 2u); }
}
fn foo(x: uint) {
if even(x) {
log(debug, x);
} else {
fail ~"Number is odd";
}
}
fn main() { foo(3u); }