re: Challenge: Write the recursive Fibonacci algorithm in a different language. VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I did this some time ago in Rust. My first approach (the naive one) is very similar to @rapidnerd 's (George Marr's) solution in R and @andreanido...
 

Just for a nice style, you could factor out the returns as if is an expression...

fn fib_super_fast(n: u64, curr: u64, prev: u64) -> u64 {
  if n == 0 {
    curr
  } else {
    fib_super_fast(n - 1, curr + prev, curr)
  }
}
code of conduct - report abuse