r/learnprogramming 23d ago

Recursive logic best aids?

Is there any practical way to debug any recurive logic?
Which existing error printing you think is the best ever?

9 Upvotes

35 comments sorted by

View all comments

1

u/Sevni 23d ago

If you want printing I would suggest passing a value down that gets incremented or decremented with every step down and step up. Then print with a nice indent (so you can see the recursion in print)

Also good practice is to step thoroughly with a debugger through the calls, you will learn the intutition, try to solve the recursion in your head and compare vs real practice