PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/run-pass/tail-direct.rs

http://github.com/jruderman/rust
Rust | 9 lines | 3 code | 5 blank | 1 comment | 6 complexity | bfe875aaae4fa8cca1742052a3996303 MD5 | raw file
1
2
3
4// -*- rust -*-
5fn main() { assert (even(42)); assert (odd(45)); }
6
7fn even(n: int) -> bool { if n == 0 { return true; } else { return odd(n - 1); } }
8
9fn odd(n: int) -> bool { if n == 0 { return false; } else { return even(n - 1); } }