Skip to content

Instantly share code, notes, and snippets.

@rtacconi rtacconi/rust_fibonacci.rs
Last active Jul 14, 2017

Embed
What would you like to do?
Calculation of fibonacci number with Rust
fn fib(x: u64) -> u64 {
if x > 1 { fib(x - 1) + fib(x - 2) } else { x }
}
fn main() {
println!("Result {}", fib(10)); // -> 55
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.