Using flowcharts, the 3 rules of grammar
(which are sometimes also called "control structures")
can be illustrated like this:
(Note: It's too hard to draw
flowcharts for a webpage,
so I won't even try, but
hopefully what I show below will
give you the flavor of
it. If anyone wants to volunteer to
give me some neat flowcharts
I can include in this webpage,
please let me know :-)
sequence (first do this; then do that):
S1 ; S2
| | V
S1 |
| | V
S2 |
| | V
IF Q
THEN S1
ELSE S2
| | V (else if false) (if true) --------------- Q? --------------- | | | | V V
|
|
| | | | V V
repetition (or looping)
(WHILE some statement Q is true, DO this)
WHILE Q DO
S
| | |<--------------- | | | | v while true | Q?------------> S | | when false | v
These, together with naming, are the 4 basic features of Pascal and Karel the Robot that we'll learn.