Home Segments Index Top Previous Next

344: Mainline

When a function, such as recursive_power_of_2, is used in its own definition, the function is said to be recursive. When a function calls itself, the function is said to recurse.

Given a positive, integer argument, there is no danger that recursive_power_of_2 will recurse forever—calling itself an infinite number of times—because eventually the argument is counted down to 0, which recursive_power_of_2 handles directly, without further recursion.