FibonacciElement, recursion and pushing variables

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FibonacciElement, recursion and pushing variables

rodrigomlp
Hi everyone!

So I pass every single test except Fibonacci element. From my searches through the forum it seems the issue arises from the fact that FibonacciElement is recursive so there is some sort of overwrite happening to the varisbles LCL, ARGs, etc if we don't make them static.

However I'm having a hard time visualizing why that is the case and what would be the solution. In another thread it was suggested that we should push the variables in writeCall as if they were static. Why?

Reply | Threaded
Open this post in threaded view
|

Re: FibonacciElement, recursion and pushing variables

WBahn
Administrator
I would expect the opposite to happen. If you use static variables then each instance of the Fibonacci function call will overwrite the values still in use by the prior invocations.

I would really need to see your code to better answer your question.