What is a recursive function?

Recursive function is a function which calls upon itself in a loop until it stops. To stop the loop, place a conditional statement inside the function and when true make the loop stop. But, before we get any deeper into wondrous world of recursion, there are several helpful topics that which may help us understand the functionality of recursion.


In programming, there are containers which can hold multiple information. For example, lets say we have total of 6 spherical objects and each one are colored in blue, red, pink, black, yellow and green. Now, let’s play a game! Let’s say we have five people who decided to play. The rule here is each player are given a choice to place a colored spherical object inside a transparent bucket or not. This action of choosing and placing can be accomplished in programming by using a for-loop method. Not only can we add, we can also remove and modify information using for-loops. We can accomplish the same task by using recursion as well.

Now you may be asking, why do we need to learn the concept of for-loops and recursion? The capabilities are almost identical, however if you get deeper into programming and learn the time complexity associated with Big O notation and the data structures. You will start to understand the differences.

Next stop… Big O Notation and data structures.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.