Subroutine is a commonly used computer programming term for a sequence of code that can be called multiple times from within a program. The word is spelled as /sʌbˈruːtiːn/, where the first syllable rhymes with ‘tub’ and the second syllable sounds like ‘routine’. The ‘sub’ in ‘subroutine’ stands for ‘subordinate’, meaning a function that performs a specific subtask within a broader task. The spelling of this word is consistent with its meaning and usage in computer programming.
A subroutine, in the field of computer programming, refers to a sequence or series of instructions that is written once and can be called or invoked from within a program multiple times. It is a fundamental concept in structured programming that aids in modularizing code and promoting code reusability.
A subroutine is designed to perform a specific task or accomplish a particular function within a larger program. It typically consists of a set of instructions that are written separately from the main program, allowing for easier organization and maintenance of code. Subroutines can be seen as mini-programs within a larger program, carrying out specific tasks or calculations.
When a subroutine is called, the control is transferred from the main program to the subroutine. The subroutine executes its set of instructions and then returns the control back to the main program. This enables the main program to utilize the functionality provided by the subroutine without having to repeat or rewrite the code each time the functionality is needed.
Subroutines are often used to break down complex problems into smaller, manageable parts, improving code readability and maintainability. They also promote code reusability, as subroutines can be invoked from various parts of a program whenever the same functionality is required.
In summary, a subroutine is a sequence of instructions written separately within a program, which can be called multiple times to perform a specific task or function, thereby improving code organization, readability, and reusability.
* The statistics data for these misspellings percentages are collected from over 15,411,110 spell check sessions on www.spellchecker.net from Jan 2010 - Jun 2012.
The word "subroutine" originated in computer programming and has its roots in mathematics. The prefix "sub-" means "under" or "below", suggesting that a subroutine is a secondary or subordinate routine within a program. The term "routine" itself in computer science refers to a sequence of instructions that perform a specific task or function.
The concept of subroutines has its origins in mathematics, where procedures or functions are defined to perform specific calculations or operations. In the early days of computer programming, subroutines were implemented to aid in modular programming, enabling programmers to break down complex tasks into smaller, reusable chunks of code.
The exact etymology of "subroutine" beyond its composition is not widely documented, but it emerged during the mid-20th century as programming languages and techniques were being developed. It became a fundamental concept in coding and is still widely used today.