4 ms·
> but it's surprisingly rare to see it in "day to day" code I rarely use them because I became tired of having to explain them to others, where I've never had
by nomel 2y ago
> but it's surprisingly rare to see it in "day to day" code
I rarely use them because I became tired of having to explain them to others, where I've never had to explain a simple while loop that accomplishes the same thing with, usually literally, a couple more lines of code.
From all of my experience, recursion is usually at the expense of clarity, and not needed.
I think it's related to the door memory effect [1]: you loose the sense of state when hopping into the function, even though it's itself.
[1] https://www.scientificamerican.com/article/why-walking-through-doorway-makes-you-forget/ https://www.scientificamerican.com/article/why-walking-throu...