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 Respostas
+ 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!