Home Segments Index Top Previous Next

339: Mainline

If you are not yet familiar with recursion, it is best to see how recursion works through an example involving a simple mathematical computation that you already know how to perform using iteration. Suppose, for example, that you want to write a function, recursive_power_of_2, that computes the nth power of 2 recursively.