PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1pure fn even(x: uint) -> bool {
 2    if x < 2u {
 3        return false;
 4    } else if x == 2u { return true; } else { return even(x - 2u); }
 5}
 6
 7fn foo(x: uint) {
 8    if even(x) {
 9        log(debug, x);
10    } else {
11        fail;
12    }
13}
14
15fn main() { foo(2u); }