Primary
Function ○꠹ᴾᴿᴳᴿᴹ|Definition|1st|20251119205401-00-⌔
Function (computer programming) - Wikipedia
Function (computer programming)
In computer programming, a function (also procedure, method, subroutine, routine, or subprogram) is a callable unit1 of software logic that has a well-formed interface and behavior and can be invoked multiple times.
Callable units provide a powerful programming tool.2 The primary purpose is to allow for the decomposition of a large and/or complicated problem into chunks that have relatively low cognitive load and to assign the chunks meaningful names (unless they are anonymous). Judicious application can reduce the cost of developing and maintaining software, while increasing its quality and reliability.3
Callable units are present at multiple levels of abstraction in the programming environment.4 For example, a programmer may write a function in source code that is compiled to machine code that implements similar semantics. There is a callable unit in the source code and an associated one in the machine code, but they are different kinds of callable units – with different implications and features.
Printed 2026-06-28.
Link to original Footnotes
“Terminology Glossary”. nist.gov. NIST. Retrieved 9 February 2024. Callable unit: (Of a software program or logical design) Function, method, operation, subroutine, procedure, or analogous structural unit that appears within a module. ↩
Donald E. Knuth (1997). The Art of Computer Programming, Volume I: Fundamental Algorithms. Addison-Wesley. ISBN 0-201-89683-4. ↩
O.-J. Dahl; E. W. Dijkstra; C. A. R. Hoare (1972). Structured Programming. Academic Press. ISBN 0-12-200550-3. ↩
“What is Abstraction in Programming? Explained for Beginners”. freeCodeCamp.org. 21 December 2022. Retrieved 25 November 2025. ↩
Secondary
• • •