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:

    Compassion has no place in the natural order of the world which operates on the basis of necessity. Compassion opposes this order and is therefore best thought of as being in some way supernatural.
    John Berger (b. 1926)

    The worth of a State, in the long run, is the worth of the individuals composing it ... a State which dwarfs its men, in order that they may be more docile instruments in its hands even for beneficial purposes—will find that with small men no great thing can really be accomplished.
    John Stuart Mill (1806–1873)

    Union of Religious Sentiments begets a surprising confidence and Ecclesiastical Establishments tend to great ignorance and corruption, all of which facilitate the Execution of Mischievous Projects.
    James Madison (1751–1836)