[计] 子程序
...程式编程 严格说来,过程式编程(procedural programming)是指引入了过程(procedure)、函数(function)或子程序(subroutine/subprogram)的命令式编程。但由于现代的命令式语言均具备此特征,故二者往往不加区分。
[计] 子例程
... subobject子对象 subroutine 子例程 subscript operator 下标操作符 ...
计 子程序调用 ; 次例程呼叫 ; 子程序调用指令
子程序 ; 次例程次程序 ; 子程序的辅助程序
计 除法子程序 ; 除法次例程 ; 除法次常式
[计]子程序
In computer programming, a subroutine is a sequence of program instructions that perform a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Subprograms may be defined within programs, or separately in libraries that can be used by multiple programs. In different programming languages, a subroutine may be called a procedure, a function, a routine, a method, or a subprogram. The generic term callable unit is sometimes used.As the name subprogram suggests, a subroutine behaves in much the same way as a computer program that is used as one step in a larger program or another subprogram. A subroutine is often coded so that it can be started (called) several times and/or from several places during one execution of the program, including from other subroutines, and then branch back (return) to the next instruction after the call once the subroutine's task is done. Maurice Wilkes, David Wheeler, and Stanley Gill are credited with the invention of this concept, which they termed a closed subroutine, contrasted with an open subroutine or macro.Subroutines are a powerful programming tool, and the syntax of many programming languages includes support for writing and using them. Judicious use of subroutines (for example, through the structured programming approach) will often substantially reduce the cost of developing and maintaining a large program, while increasing its quality and reliability. Subroutines, often collected into libraries, are an important mechanism for sharing and trading software. The discipline of object-oriented programming is based on objects and methods (which are subroutines attached to these objects or object classes).In the compiling method called threaded code, the executable program is basically a sequence of subroutine calls.