There are three fundamental control structures in structured programming.
- Sequence Control Structure: This refers to the line-by-line execution, in which statements are executed sequentially, in the same order in which they appear in the script. They might, for example, carry out a series of read or write operations, arithmetic operations, or assignments to variables.
- Decision Control Structure: Depending on whether a condition is true or false, the decision control structure may skip the execution of an entire block of statements or even execute one block of statements instead of another.
- Loop Control Structure: This is a control structure that allows the execution of a block of statements multiple times until a specified condition is met.
If you didn’t quite understand the deeper meaning of these three control structures, don’t worry, because upcoming articles will analyze them very thoroughly. Patience is a virtue. All you have to do for now is wait!
Exercise – Understanding Control Structures Using Flowcharts
Using flowcharts, give an example for each type of control structure.
Solution
Example of a Sequence Control Structure
Example of a Decision Control Structure
Example of a Loop Control Structure