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:

    A sleeping man holds in a circle around him the thread of the hours, the order of years and of worlds. He consults them instinctively upon awaking and in one second reads in them the point of the earth that he occupies, the time past until his arousal; but their ranks can be mingled or broken.
    Marcel Proust (1871–1922)

    Inferiors revolt in order that they may be equal, and equals that they may be superior. Such is the state of mind which creates revolutions.
    Aristotle (384–322 B.C.)

    I am gradually drifting to the opinion that this Rebellion can only be crushed finally by either the execution of all the traitors or the abolition of slavery. Crushed, I mean, so as to remove all danger of its breaking out again in the future.
    Rutherford Birchard Hayes (1822–1893)