Blackmist@lemmy.worldto
Programming@programming.dev•when is it best to use a recursive function vs a for loopEnglish

3 years
When navigating a tree structure.
Processing files and folders, expression parsing, that kind of thing.
I’ve no idea why the factorial example is so popular, because it’s one of the worst use cases for it. Still, I guess it can teach a new programmer what a stack overflow is.
Which it almost never is.
Any data as simple as that is unlikely to reach a number of rows likely to cause an issue with performance.