ABSTRACT

The programming technique of a program calling itself is called recursion. There are two kinds of recursions: direct recursion and indirect recursion. We can use the Droste effect to illustrate recursion (Figure 3.1):

The Droste effect … is the effect of a picture appearing within itself, in a place where a similar picture would realistically be expected to appear. The appearance is recursive: the smaller version contains an even smaller version of the picture, and so on. (https:// en.wikipedia.org/wiki/Droste_effect)

Recursion is to change a large and complex problem into a smaller problem similar to the original problem and solve it. Therefore, a small amount of program code can implement repeated calculation, making the program more concise and clear.