Consider the following example of the recursive function countdown. If it is called with an n value of 0, it displays the word Blastoff!. Otherwise, it displays the number and then makes a recursive call to countdown, passing n - 1 as the argument.
What was different this time? The work of displaying the number was done after the recursive call. So level 3 did not print until after level 2 was done. And level 2 did not print until after level 1 was done...
A recursive call breaks the execution of a function into two parts. The code before the recursive call runs before the next recursive call executes. The code after the recursive call runs after the recursive call completes.
Back in countdown(1) execution resumes after the recursive call and displays the finish message. It then returns to where it was called (countdown(2)).
Back in countdown(2) execution resumes after the recursive call and displays the finish message. It then returns to where it was called (countdown(3)).