Illustrative flowchart of our recursive function

Our main function isn’t happy until our y value equals 0. To evaluate this condition it runs through a series of if statements that, if triggered, will modify the value of y, adding or subtracting accordingly. Our function is called over and over again until it is satisfied. Eventually our function calls itself again a last time, having reached the final value of x = 0 and y = 0, it can finally rest.

--

--