Until now we had said that a program is a sequence of statements (or actions) that are executed linearly from start to finish.
Well… actually that’s not entirely true. It is true that our program will become a series of instructions, placed in series one after another.

When executed, somewhere, the computer will keep track of which is the current instruction. This “arrow” that indicates the instruction to be executed will change to go through the entire program.
However, if the execution point could only move forward one by one, we could only do a predetermined sequence of actions (we could do “big calculations” but little more).
For this to be interesting, the execution point can change at any moment to any other point in the program (that is, it can skip several instructions forward, and even backward).
This is what we call program execution flow. The instructions and tools we have to manage and change the program are called flow control structures.
Flow control structures are the instructions that allow a program to make decisions and perform different actions based on given conditions, and they are one of the most important parts of programming.
Types of Flow Control Structures
There are several types of flow control structures, including:
- Jump structures: allow the programmer to transfer flow control to a different location in the program. The most common jump structure is GO-TO.
- Conditional structures: allow the program to make decisions based on a condition. The most common conditional structures are IF, IF-ELSE, IF-ELSEIF, SWITCH, and the ternary operator.
- Loop structures: allow the program to repeat a sequence of instructions multiple times. The most common loop structures are WHILE, DO-WHILE, FOR, FOREACH.
- Error handling structures: allow the program to respond to errors or exceptions. The most common one is TRY-CATCH.
Not all of them are equally “well-regarded”. In particular, we will see that GO-TO is something we shouldn’t use, and TRY-CATCH would be debatable. But since the goal of the course is to talk about programming and its evolution, I think it’s important to include them all.
