Introduction to the CSD - Selection

The selection statement usually comes in four basic flavors: the if statement, the if..else statement, the if..else if statement, and the switch statement. The CSD notation for each of these is illustrated below. Note that the connotation of each CSD selection construct is identical.

The True/False condition itself is marked with a small diamond, just as in a flow chart. The statements to be executed if the condition is true are marked by a solid line leading from the right of the decision diamond. The control path for a false condition is marked with a dotted line leading from the bottom of the diamond to the next executable statement, either another decision diamond, an else clause, a default clause, or the end of the decision statement.

Also notice that in the switch statement, arrows point in from the decision diamond to the beginning of each case condition.


Prev Page | Next Page

Return to GRASP Documentation Page