subroutine

/ˈsʌbruːtiːn/ (bre, ipa) · /ˈsʌbruːtiːn/ (ame, ipa) · /ˈsəb-(ˌ)rü-ˌtēn/ (ame, mw)

subroutine — noun

1. a named block of computer code within a program that carries out one specific ta

1.名詞B2
釋義

a named block of computer code within a program that carries out one specific task and can be used repeatedly whenever that task is needed — for example, a subroutine that calculates a total, checks a password, or draws a shape on the screen.

例句

Asher wrote a subroutine to calculate the average temperature from daily readings.

subroutine + to-infinitive for purpose

When the game checks a score, it calls the same subroutine instead of repeating code.

call a subroutine — most common verb collocation

同義詞
  • function

    the most common modern term; a function usually returns a value, while a subroutine in older terminology does not.

  • procedure

    used especially in Pascal and SQL; focuses on the sequence of steps rather than the code block itself.

  • method

    object-oriented term for a subroutine that belongs to a class.

  • routine

    shorter, general term; can refer to any set of coded instructions.

文法句型

subroutine + that-clause

call/invoke/define + subroutine

用法筆記

Frequently used with the verbs call, invoke, define, run, and return from. In modern programming languages, subroutines are often called functions or methods, depending on the language paradigm.

常見錯誤

The subroutine is a program.
The subroutine is part of a program.
💡a subroutine is a building block inside a larger program, not a program on its own.
I used a subroutine for open the file.
I used a subroutine to open the file.
💡the purpose of a subroutine is expressed with to + infinitive, not for + verb.