Recursion It is better than loops when you have to do multiple nested iterations.If you would do it with loops you would need to keep track of the index on each nested loopand gets more complicated to reason about.