Further programming language operations - AQASubroutines

Proficient programming requires knowledge of many techniques. These techniques allow for powerful, complex programs.

Part ofComputer ScienceComputational thinking and problem solving

Subroutines

are smaller, named sections of code that are written within a larger . 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 . 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 known as . However, the code only has to be written once, resulting in shorter programs.