function factorial(n):

   if n <= 1:
      return 1           # base case -- stops the recursion
   return n * factorial(n - 1) # each call waits on the call stack

 # factorial(4) pushes 4 frames before any multiplication happens:
 # factorial(4) -> 4 * factorial(3) -> 4 * (3 * factorial(2)) -> ...
