Skip to content

Computer Science · Ch 4 — Introduction to Problem Solving

Flow of Control

4.5

Flow of Control

The flow of control is the order in which the events of an algorithm unfold — exactly what a flowchart's arrows depict. Events need not always march straight through from first step to last; the flow can take three shapes:

  • Sequence — the events flow one after another, in order (section 4.5.1).
  • Selection — the flow branches, taking one path or another based on a decision (section 4.5.2).
  • Repetition — some part of the flow repeats a finite number of times (section 4.5.3). …