mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-12 06:53:05 +00:00
18 lines
278 B
Rust
18 lines
278 B
Rust
//@ run-pass
|
|
|
|
fn even(x: usize) -> bool {
|
|
if x < 2 {
|
|
return false;
|
|
} else if x == 2 { return true; } else { return even(x - 2); }
|
|
}
|
|
|
|
fn foo(x: usize) {
|
|
if even(x) {
|
|
println!("{}", x);
|
|
} else {
|
|
panic!();
|
|
}
|
|
}
|
|
|
|
pub fn main() { foo(2); }
|