Return Value

Get to know about how to return a value from a function. Also, discover recursion which is a very important concept in programming.

We'll cover the following

Let’s consider another example, one where we want our function to return a value. Let’s write a function to compute Fibonacci numbers (Wikipedia). Fibonacci numbers are defined as:

\begin{equation} F_{n} = F_{n-1} + F_{n-2} \end{equation}

where F0 = 0 and F1 = 1.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy