Home Segments Index Top Previous Next

319: Mainline

Whenever a method, such as recursivePowerOfTwo, is used in its own definition, the method is said to be recursive. When a method makes use of itself, the method is said to recurse.

Given a positive, integer argument, there is no danger that recursivePowerOfTwo will recurse forever—sending an infinite number of messages—because eventually the receiver is counted down to 0, which handles the recursivePowerOfTwo message directly, without further recursion.