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

    Revolution is like the daughters of Pelias: it cuts humanity to pieces in order to rejuvenate it.
    Georg Büchner (1813–1837)

    My weakness has always been to prefer the large intention of an unskilful artist to the trivial intention of an accomplished one: in other words, I am more interested in the high ideas of a feeble executant than in the high execution of a feeble thinker.
    Thomas Hardy (1840–1928)