Jacob Krol

Sign in

Programming with recursion opens up countless opportunities for you as a developer. However, designing your first recursive function (one that isn’t factorials … my goodness is that the only example everyone is taught?) is easier said than done. Let’s learn how to construct a recursive function.

4 stick figures sit around a table. The first says your party enters the tavern. The second responds I gather everyone around a table. I have the elves start whittling dice and get out some parchment for character sheets. The first interrupts hey no recursing.
4 stick figures sit around a table. The first says your party enters the tavern. The second responds I gather everyone around a table. I have the elves start whittling dice and get out some parchment for character sheets. The first interrupts hey no recursing.
xkcd 244: Tabletop Roleplaying

What is a recursive function?

A recursive function is one that calls itself. This can be immensely powerful for performing scalable tasks like tracing the contents of a tree.

At its basic level, we need to perform some action and then perform that same action…

Jacob Krol

Full-Stack Web Developer; Short-Stack Pancake Lover

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store