bdfs1m0c | Structured Programming Macros |
In structured programming theory, only three basic control logic structures are required to program any function:
A sequence is the processing of one function after the other, as shown in Figure 1. No special logic is required because processing is always sequential.
Figure 1. Sequence: Processing Code Sequentially
A selection is the choice between two or more functions to be processed based on a condition.
For example, the IF macro group, shown in Figure 2, is used for selection.
Figure 2. Selection: Using a Condition
The CASE macro group, shown in Figure 3, is another example of a macro group used for selection.
Figure 3. Selection: Using a Case Number
An iteration is the repeated processing of the same code while, or until, a condition is true, as shown in Figure 4.
Figure 4. Simple Iteration: The Difference between DO WHILE and DO UNTIL
Notes: