0

Swift Function Types

I am doing the Swift fundamentals right now and I really don’t understand the last question from the segment: function types. I have unlocked the answer, which is 2, but that doesn‘t make things clearer for me. I don’t really unterstand it that much at all, but especially the question mark confuses me. There are no comments as well. I would really appreciate your help.

19th Jan 2018, 4:06 PM
Lena
2 ответов
+ 2
It's the Fibonacci series. Google it, so you know how it looks. The implementation here is recursive: If the input is 0 or 1, return it. Otherwise return the sum of its two predecessors.
20th Jan 2018, 2:28 AM
1of3
1of3 - avatar
0
Thank you!
20th Jan 2018, 12:27 PM
Lena