Home Segments Top Top Previous Next

444: Mainline

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

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