Skip to content

Instantly share code, notes, and snippets.

@olsonjeffery
Created May 25, 2014 12:16
Show Gist options
  • Save olsonjeffery/c02c4cc58de08497c565 to your computer and use it in GitHub Desktop.
Save olsonjeffery/c02c4cc58de08497c565 to your computer and use it in GitHub Desktop.
fn fact(n: i64) -> i64 {
if n <= 1 { 1 }
else { n * fact(n-1) }
}
fn main() {
println!("fact 10: {}", fact(10));
println!("fact 100: {}", fact(100));
}
jeff@mbp:~/src/sandbox$ ./fact
fact 10: 3628800
fact 100: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment