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:

    Just as a new scientific discovery manifests something that was already latent in the order of nature, and at the same time is logically related to the total structure of the existing science, so the new poem manifests something that was already latent in the order of words.
    Northrop Frye (b. 1912)

    The rebel, unlike the revolutionary, does not attempt to undermine the social order as a whole. The rebel attacks the tyrant; the revolutionary attacks tyranny. I grant that there are rebels who regard all governments as tyrannical; nonetheless, it is abuses that they condemn, not power itself. Revolutionaries, on the other hand, are convinced that the evil does not lie in the excesses of the constituted order but in order itself. The difference, it seems to me, is considerable.
    Octavio Paz (b. 1914)

    I will soon be going out to shape all the singing tomorrows.
    Gabriel Péri, French Communist leader. Letter, July 1942, written shortly before his execution by the Germans. Quoted in New York Times (April 11, 1943)