
13.2 Recursion with a Return Value 947
case argument receives its return value, which allows that method to return
a value to its caller, and so on, until the method is able to return a value to
the initial caller. In this way, the return values unravel up to the initial
caller.
To see how this works, let’s look at an example of a recursive method that
returns a value.
13.2.1 Computing the Factorial of a Number
We will define a recursive method to compute and return the factorial of a
positive integer.
The factorial of a positive number is defined as follows:
factorial(n) = n ! = n * (n 1) * (n 2) * (n 3) * ... .* 4 * 3 * 2 * 1
The factorial of