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:

    This entire most beautiful order of good things is going to pass away after its measure has been exhausted; for both morning and evening were made in them.
    St. Augustine (354–430)

    If we are the younger, we may envy the older. If we are the older, we may feel that the younger is always being indulged. In other words, no matter what position we hold in family order of birth, we can prove beyond a doubt that we’re being gypped.
    Judith Viorst (20th century)

    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)