ABSTRACT

A subprogram is just like a main program, which can be compiled independent of the main program. It can be debugged and tested by some driver programs. Different users can share a subprogram, which can be ported from one program to another. A function subprogram starts with keyword function followed by the name of the function and the arguments of the function within parentheses. If there is more than one argument, the arguments are separated by a comma. A subroutine subprogram may return any number of values including zero to the calling program. The subroutine subprogram starts with keyword subroutine followed by the name of the subroutine and its arguments separated by a comma within parentheses. The subprograms discussed so far are external procedures. An internal procedure is a subprogram that is contained within a main program or another subprogram. The internal procedures are accessible from the unit that contains the internal procedure.