/src/test/run-pass/if-check.rs
http://github.com/jruderman/rust · Rust · 15 lines · 13 code · 2 blank · 0 comment · 7 complexity · eab5b38e381eda21ebc0ea6bd9d68297 MD5 · raw file
- 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;
- }
- }
- fn main() { foo(2u); }