好词典

subroutine

UK //ˌsʌb.ruːˈtiːn//US //ˈsʌb.ruːˌtiːn//

词源

源自 'sub-'(下,次要)和 'routine'(例行程序),20世纪中期计算机科学术语。

noun

❶ 子程序,是计算机程序中完成特定任务的一段独立代码,可以被主程序或其他子程序反复调用。

“The main program calls a subroutine to calculate the square root.”

(主程序调用一个子程序来计算平方根。)

“You can reuse the same subroutine in different parts of your code.”

(你可以在代码的不同部分重复使用同一个子程序。)

同义词:function, procedure, method

常见短语

call a subroutine — 调用子程序,指在程序中执行子程序的代码。

“The program calls a subroutine to sort the data.”

(程序调用一个子程序来对数据进行排序。)

nested subroutine — 嵌套子程序,指在一个子程序内部调用另一个子程序。

“The nested subroutine makes the code more modular.”

(嵌套子程序使代码更加模块化。)