Recursion
Recursion makes the method call itself over and over again until reaching a bass case.
It provides a way to break complicated problems down into simple problems which are easier to solve.
Bass Case
Just as loops can run into the problem of infinite looping, recursive functions can run into the problem of infinite recursion. Infinite recursion is when the function never stops calling itself.
Every recursive function should have a bass condition, which is the condition where the function stops calling itself. In the previous example, the bass condition is when the parameter k becomes 0.
​
In this example, the function adds a range of numbers between a start and an end. The bass condition for this recursive function is when end is not greater than start: