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.
2 Answers
+ 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.
0
Thank you!