+ 1

Fibonacci code challenge

What is the output of the following code? func fib(n: Int) -> Int { return n < 2 ? N :(fib(n-1) + (fib(n-2)) } print(fib(3))

20th Nov 2017, 3:19 AM
Solomon Reese
Solomon Reese - avatar
1 Réponse
+ 2
The output should be 2.
20th Nov 2017, 4:21 AM
Halla