In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperativeprogram are executed or evaluated.
Categories
The kinds of control flow statements supported by different languages vary, but can be categorized by their effect:
- Continuation at a different statement (unconditional branch or jump)
- Executing a set of statements only if some condition is met (choice - i.e., conditional branch)
- Executing a set of statements zero or more times, until some condition is met (i.e., loop - the same as conditional branch)
- Executing a set of distant statements, after which the flow of control usually returns (subroutines, coroutines, and continuations)
- Stopping the program, preventing any further execution (unconditional halt)