# Understanding a Recursive Problem

In this lesson, we'll learn methods to understand and visualize a recursive function.

## Understanding the Problem

In the previous lessons, we learned the basic concept of recursion, what it is and when it can be used. Now, we will discuss how recursion works.

Let’s have a look at an example. The code below prints a pattern, that subtracts $5$ from the `targetNumber`

until we reach a negative number or $0$. Then we add $5$ until we reach the `targetNumber`

again.

For example:

If `targetNumber`

$= 10$, then our pattern will be
$10\:$ $5\:$ $0\:$ $5\:$ $10$.

If `targetNumber`

$= 8$, then our pattern will be $8$ $\:3$ $-2$ $\:3$ $\:8$.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.