Recursive Call - Order of Execution

Order of Execution

In a recursive function, the position in which additional statements (i.e., statements other than the recursive call itself) are placed is important. In the simple case of a function calling itself only once, a statement placed before the recursive call will be executed first in the outermost stack frame, while a statement placed after the recursive call will be executed first in the innermost stack frame. Consider this example:

Read more about this topic:  Recursive Call

Famous quotes containing the words order of, order and/or execution:

    An example is often a deceptive mirror, and the order of destiny, so troubling to our thoughts, is not always found written in things past.
    Pierre Corneille (1606–1684)

    In order for the artist to have a world to express he must first be situated in this world, oppressed or oppressing, resigned or rebellious, a man among men.
    Simone De Beauvoir (1908–1986)

    It is clear that in a monarchy, where he who commands the exceution of the laws generally thinks himself above them, there is less need of virtue than in a popular government, where the person entrusted with the execution of the laws is sensible of his being subject to their direction.
    —Charles Louis de Secondat Montesquieu (1689–1755)