Subroutine: meaning, definitions and examples

๐Ÿ’ป
Add to dictionary

subroutine

 

[หˆsสŒb.ruหหŒtiหn ]

Definition

Context #1 | Noun

computer programming

A subroutine is a sequence of program instructions that perform a specific task, packaged as a unit. It is used to break down a program into smaller, more manageable pieces. Subroutines can be called multiple times within a program, allowing for code reusability.

Synonyms

function, method, procedure.

Which Synonym Should You Choose?

arrow down
Word Description / Examples
subroutine

It's often used in the context of early programming languages like Fortran, or when referring generally to a segment of code designed to perform a specific task within a larger program.

  • The subroutine is called multiple times within the main program.
function

This term is widely used in many programming languages to describe a reusable block of code that performs a specific task and often returns a value. It is applicable in both procedural and object-oriented programming.

  • The function calculates the square root of a number.
  • You should define the function before calling it.
procedure

Generally used in the context of procedural programming languages like Pascal. It is a block of code that performs some operations and does not return a value.

  • The procedure updates the user interface.
  • You should document what each procedure does.
method

Commonly used in object-oriented programming to describe a function that is associated with an object or a class.

  • The method initializes the class attributes.
  • You can call the method using the instance of the class.

Examples of usage

  • Before the main program can run, it calls the subroutine to initialize the required variables.
  • The subroutine for sorting algorithm can be reused in different parts of the program.

Interesting Facts

Etymology

  • The term 'subroutine' came into use in the 1950s, combining 'sub' meaning 'under' or 'secondary' and 'routine' meaning a sequence of steps to perform.
  • Earlier programming languages used simpler terms like 'label' for similar concepts before 'subroutine' became widely adopted.

Programming

  • Subroutines help manage complex programs by breaking them into smaller, manageable chunks, improving readability and maintainability.
  • Many programming languages, like Python and Java, allow developers to write subroutines, enhancing code reuse and efficiency.

Mathematics

  • In mathematics, subroutines can represent functions, which take inputs, perform calculations, and return outputs.
  • The concept of functions in programming is similar to mathematical functions, where subroutines play a crucial role in executing operations.

Computer Science

  • The use of subroutines is foundational in software development; it allows for modular programming, where different parts of a program can be developed and tested independently.
  • Subroutines can also be recursive, meaning they can call themselves, which is useful for solving problems that can be broken down into smaller instances.

Pop Culture

  • The concept of subroutines appears in popular video games, where characters (or systems) may have specific actions (or abilities) that can be performed repeatedly.
  • Animated shows often use the analogy of a subroutine when a character has to perform a specific task multiple times, emphasizing efficiency in their actions.

Translations

Translations of the word "subroutine" in other languages:

๐Ÿ‡ต๐Ÿ‡น subrotina

๐Ÿ‡ฎ๐Ÿ‡ณ เค‰เคชเค•เฅเคฐเคฎ

๐Ÿ‡ฉ๐Ÿ‡ช Unterprogramm

๐Ÿ‡ฎ๐Ÿ‡ฉ subrutin

๐Ÿ‡บ๐Ÿ‡ฆ ะฟั–ะดะฟั€ะพะณั€ะฐะผะฐ

๐Ÿ‡ต๐Ÿ‡ฑ podprogram

๐Ÿ‡ฏ๐Ÿ‡ต ใ‚ตใƒ–ใƒซใƒผใƒใƒณ

๐Ÿ‡ซ๐Ÿ‡ท sous-programme

๐Ÿ‡ช๐Ÿ‡ธ subrutina

๐Ÿ‡น๐Ÿ‡ท alt program

๐Ÿ‡ฐ๐Ÿ‡ท ์„œ๋ธŒ๋ฃจํ‹ด

๐Ÿ‡ธ๐Ÿ‡ฆ ุฑูˆุชูŠู† ูุฑุนูŠ

๐Ÿ‡จ๐Ÿ‡ฟ podprogram

๐Ÿ‡ธ๐Ÿ‡ฐ podprogram

๐Ÿ‡จ๐Ÿ‡ณ ๅญ็จ‹ๅบ

๐Ÿ‡ธ๐Ÿ‡ฎ podprogram

๐Ÿ‡ฎ๐Ÿ‡ธ undirlota

๐Ÿ‡ฐ๐Ÿ‡ฟ ั–ัˆะบั– ะฑะฐา“ะดะฐั€ะปะฐะผะฐ

๐Ÿ‡ฌ๐Ÿ‡ช แƒฅแƒ•แƒ”แƒžแƒ แƒแƒ’แƒ แƒแƒ›แƒ

๐Ÿ‡ฆ๐Ÿ‡ฟ alt proqram

๐Ÿ‡ฒ๐Ÿ‡ฝ subrutina

Word Frequency Rank

With rank #19,125, this word belongs to specialized vocabulary. While not common in everyday speech, it enriches your ability to express complex ideas.