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 and/or execution:

    What verse is for the poet, dialectical thinking is for the philosopher. He grasps for it in order to get hold of his own enchantment, in order to perpetuate it.
    Friedrich Nietzsche (1844–1900)

    If Germany is to become a colonising power, all I say is, “God speed her!” She becomes our ally and partner in the execution of the great purposes of Providence for the advantage of mankind.
    —W.E. (William Ewart)