Control Structures
Most programming languages use 3 basic control structures:
- Sequence: statements are executed one after the other.
- Selection or branching: One statement or group of statements is executed if a Boolean expression is true, another (optional) statement or group of statements is executed if the Boolean expression is false.
- Iteration or looping: One statement or group of statements is executed repeatedly until some exit condition is met.
In programming languages where there is a graphical user interface (GUI) the program will repeatedly "listen" for events to occur. When an event occurs a function is executed in response to that event. Events include things such as a file finishes loading, the user clicks a button, moves the mouse or types a key.
These types of programs are called event driven programs.