ABSTRACT

It did not take long for programmers to discover that code often contained sections that performed identical operations. For example, a program that performed geometrical calculations had to calculate the area of a circle over and over again. Recoding the same routine wasted programming effort, made the program larger, and increased the possibility of error. The solution was to create subprograms within the main program. The subprogram would contain a processing routine that could be reused as often as necessary without having to recode it. An added advantage was that subprograms reduced code size and simplified testing and error correction. In this case, the subprogram to calculate the area of a circle would receive the radius parameter from the caller. The subroutine would then perform the required calculations and return the circle's area.