control flow(控制流/控制流程):指程序在运行时语句与指令执行的先后顺序与路径,通常由条件判断(if/else)、循环(for/while)、跳转(return/break/continue)、异常处理(try/catch)以及函数调用等结构决定。
/kənˈtroʊl floʊ/
Control flow determines which lines of code run next.
控制流决定接下来会执行哪些代码行。
In this program, the control flow branches on user input, loops until a valid value is entered, and then returns from the function.
在这个程序中,控制流会根据用户输入发生分支,循环直到输入有效值,然后从函数返回。
control 来自拉丁语 contra(相对、对抗)与中古法语/拉丁语系词根演变,逐渐形成“支配、调控”的含义;flow 来自古英语 flōwan,意为“流动”。合起来 control flow 字面是“被控制的流动”,在计算机科学语境中引申为“程序执行路径的流动与调度”。