subroutine

noun
UK /ˈsʌbruːtiːn/
US /ˈsʌbruːtiːn/

A small set of instructions that a computer can run again and again.

The programmer wrote a subroutine to add up all the numbers.


OTHER MEANINGS

2. A smaller part of a larger computer program that does one job.

The game calls a subroutine whenever the player scores a point.

3. A set of steps that can be reused in many places in code.

Instead of copying the same lines, she put them in a subroutine.

4. A routine that returns to the main program when it finishes.

After the subroutine ends, the program continues from where it left off.