On the other side, a "while" loop would become a condition that makes a block repeat (an arrow which returns back to the point where the condition is checked):
And a "do .. while" loop becomes a condition at the end of a block that is repeated:
But there are other modern notations which can be more expressive. We'll discuss only one of them: Chapin diagrams (also called "box diagrams"). They represent each statement within a box:
Conditions are indicated by dividing the boxes into an upper part and two lower parts:
And the repetitive conditions are represented with a vertical bar on the left, which marks what is repeated. If the condition is checked at the end (do...while), we use this notation:
And this notation if the condition is at the beginning (while):
There is no special representation for the "for" statements.
No comments:
Post a Comment