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

    If I were asked to chose between execution and life in prison I would, of course, chose the latter. It’s better to live somehow than not at all.
    Anton Pavlovich Chekhov (1860–1904)

    Do we have to talk in order to agree or agree in order to talk?
    José Bergamín (1895–1983)