subroutinePortion of code that may be called to execute anywhere in a program. are smaller, named sections of code that are written within a larger programSequences of instructions for a computer.. The purpose of a subroutine is to perform a specific task. This task may need to be done more than once at various points in the main program.
Subroutines are usually small in size, which means they are much easier to write, test and debugThe process of finding and correcting programming errors. . They are also easy for someone else to understand.
As they are written outside of the main program, subroutines can be saved separately as modules and used again in other programs. This saves time because the programmer can use code that has already been written, tested and debugged.
A subroutine may be used repeatedly at various points in the main program and changed by passing in dataUnits of information. In computing there can be different data types, including integers, characters and Boolean. Data is often acted on by instructions. known as parameterIn computer programming, a parameter is a value that is passed into a function or procedure.. However, the code only has to be written once, resulting in shorter programs.