Recursion (computer Science) - 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:  Recursion (computer Science)

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

    It is the international system of currency which determines the totality of life on this planet. That is the natural order of things today. That is the atomic, and sub-atomic, and galactic
    structure of things today. And you have meddled with the primal forces of nature! And you will atone! Am I getting through to you, Mr. Beale?
    Paddy Chayefsky (1923–1981)

    The exterior must be joined to the interior to obtain anything from God, that is to say, we must kneel, pray with the lips, and so on, in order that proud man, who would not submit himself to God, may be now subject to the creature.
    Blaise Pascal (1623–1662)

    Those who govern, having much business on their hands, do not generally like to take the trouble of considering and carrying into execution new projects. The best public measures are therefore seldom adopted from previous wisdom, but forced by the occasion.
    Benjamin Franklin (1706–1790)