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:

    We are born into them, marry into them, even create them among the people we love. They come large and extended...or small and nuclear. But whatever their size or wherever they live, strong families give us the nurturance and strength we need in order to survive.
    Andrea Davis (20th century)

    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)