Programming Structures
Programming Structures
Selection
Binary Selection
The binary selection structure is represented by IF statements
in pseudocode. In a flowchart, the decision symbol is used
with the TRUE path branching to the right and the FALSE path
branching to the left.
Multi-way Selection
The multi-way selection structure is represented in
pseudocode by the CASE statement. In a flowchart, a decision
symbol is used with the options branching from a single line attached to the bottom of
the diamond symbol.
Repetition
Guarded / Pre-test Loops
Guarded loops are represented by WHILE or FOR in pseudocode. In flowcharts, a decision
symbol is used. The TRUE line flows down from the bottom of the diamond symbol,
looping back up on the left side. An arrow should be used to show that the flow of the
program is going up (against the norm). The FALSE line connects to the right of the
diamond and runs down the right side of the page before returning to a central point.
The condition (decision / question) is tested at the beginning of the loop. This means
that the code within the loop may not run at all.