Re:How recursion got into programming: a comedy of errors
by skriticos2 on Wednesday July 23, 2014 @07:43AM
(#8073797)
Admittedly recursion is not done often, but in some cases it's very useful.
For example, recently I created an application with a tree record structure where the user could delete a node and it needed to delete all sub-nodes.
With recursion it's easy to tell: 'call yourself for all subnodes you have, then delete yourself'. This is something that's much more difficult to express with the usual for/while constructs.
Example: https://github.com/skriticos/tac_workflow/blob/9890e66d60851...