3 ms·
Recursion is more general than loops. Even if you have tail call optimization there are thing that recursion can do and loops can't (without a supporting data s
by alserio 4y ago
Recursion is more general than loops. Even if you have tail call optimization there are thing that recursion can do and loops can't (without a supporting data structure as a stack or THE stack, but that IS recursion again).
Being more general, an argument could be made for using the construct with the least power.
But, as always, it depends on what are you trying to achieve and what are your constraints.