Review of subroutine
 

Subroutines (a.k.a.: functions, procedures, sub-programs, methods):

  • Other names for subroutine are:  

    • Procedure
    • Function and
    • Method

  • Subroutine is a program unit that can be called (= invoked) from anywhere in the computer program

  • Control flow of a subroutine call:

      • When a subroutine is called (= invoked), the program execution is transfered to the first instruction of the subroutine

      • Program execution will continue in the subroutine until the subroutine returns

      • When the subroutine returns, the program execution will continue at the statement after the subroutine call