Solution Review 3: Find nth Fibonacci Number
Explore how to write a recursive function in Rust to calculate the nth Fibonacci number. Understand the base case and recursive calls that define this function, and see how recursion works in Rust through step-by-step explanations and examples. This lesson builds on your knowledge of Rust functions and prepares you for working with more complex data types.
We'll cover the following...
We'll cover the following...
Solution:
Explanation
A recursive function, fibonacci, takes a parameter term of type i32 and returns an integer of type i32, i.e., the nth term of the Fibonacci number.
The recursive function ...