Meaning & use

subroutine

noun·Academiccomputingtechnical

Last updated

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

Meaning

  1. nouncountablecomputing

    A named set of instructions inside a program that does one job and can be used again from many places.

    Grammar: A countable noun: call a subroutine.

    Patterns

    • call a subroutine
    • write a subroutine for something

    The program calls a subroutine to sort the list.

    She wrote a subroutine that checks the password length.

    Changing the subroutine fixed the bug everywhere.

Word forms

pluralsubroutines

Common combinations

call a subroutine
The main code calls a subroutine to print the report.
write a subroutine
He wrote a subroutine to format dates.
nested subroutine
A nested subroutine runs inside another one.
reusable subroutine
A reusable subroutine saves time.

Synonyms and how they differ

function
Function is the common modern term and often implies returning a value, unlike a plain subroutine.
procedure
Procedure is used in some languages for a subroutine that returns no value.
method
Method is a subroutine attached to an object in object-oriented programming.

Opposites

main program

Word family

routine noun
a set of instructions or a regular procedure
subprogram noun
a smaller program within a larger one
subroutines noun
more than one such block

Commonly confused: subroutine or subroutine vs routine?

subroutine vs subroutine vs routine

A routine in programming can be any set of instructions, while a subroutine specifically sits within and is called by a larger program.

Practice

A programmer puts the code that calculates tax into a ___ so it can be reused.

Make it your own

Write a sentence using “subroutine”, then check it and compare it with the examples above.

Your sentence stays on this page and is not sent anywhere.

Explore more words