EWD249 - 24
|
v
+- - - - - - - - - - - - - - - - - - - - - - - -+
| +-------+ |
| | i | |
| +-------+ |
| / / | \ \ |
| / / : \ \ |
| +-----+ +-----+ : +-----+ |
| | S1 | | S2 | : | Sn | |
| +-----+ +-----+ : +-----+ |
| \ \ | / |
| \ \ | / |
| \ \ | / |
+- - - - -\- - - -\- - |- - /- - - - - - - - - -+
\ \ | /
\ \ | /
\ \ |/
---------+
|
v
case i of(S1; S2; ......; Sn)
These flowcharts share the property that they have a single entry at the top and a single exit at the bottom: as indicated by the dotte block they can again be interpreted (by disregarding what is inside the dotted lines) as a single action in a sequential computation. To be a little bit more precise: we are dealing with a great number of possible computations, primarily decomposed into the time-succession of subactions and it is only on closer inspection -i.e. by looking inside the dotted block- that is revealed that over the collection of possible computations such a subaction may take one of an enumerated set of distinguished forms.
The above is sufficient to consider a class of computations that are primarily decomposed into the same set of enumerated subactions; they are insufficient to consider a class of computations that are primarily decomposed into a varying number of subactions (i.e. varying over the class of computations considered). It is here that the usefulness of the repetition clauses becomes apparent. We mention "while condition do statement" and "repeat statement until condition" that may be represented in flowchart form as follows.