| was car just running and quit now? | yes | is gas gauge on empty? | yes | get gas
| no
| call tow truck
| no
| does engine crank?
| yes
| check gas
| no
| check battery
| |
cara.pas
carb.pas
- readln(color);
- if color = 'red' then
- writeln('Keep going.');
- if color = 'yellow' then
- writeln('You need to go faster!');
- if color = 'red' then
- writeln('I guess you should stop.');
| <compound statement> | -> | begin
| | | //a sequence of <statements>s
| | | each followed by a semicolon//
| | | end
| |
| <statement> | -> | writeln(<string expression>) | |
| <statement> | -> | writeln(<identifier>) | |
| <statement> | -> | writeln(msg1) |
| #4 | <statement> | -> | writeln(<string expression>) |
| #3 | <statement> | -> | writeln('//any string//') |
| <statement> | -> | writeln('Hi there!') |
- begin
- readln(msg);
- writeln(msg);
- end
| #7 | <compound statement> | -> | begin |
| <statement>; | |||
| <statement>; | |||
| end | |||
| <compound statement> | -> | begin | |
| #5 | readln(<identifier>); | ||
| <statement>; | |||
| end | |||
| <compound statement> | -> | begin | |
| #1 | readln(msg); | ||
| <statement>; | |||
| end | |||
| <compound statement> | -> | begin | |
| readln(msg); | |||
| #4 | writeln(<string expression>) ; | ||
| end | |||
| <compound statement> | -> | begin | |
| readln(msg); | |||
| #2 | writeln(<identifier>) ; | ||
| end | |||
| <compound statement> | -> | begin | |
| readln(msg); | |||
| #1 | writeln(msg); | ||
| end |
| 8. | <statement> | -> | if <booliean expression> then
| | | <compound statement>
| | | else
| | | <compound statement>
| |
| 9. | <statement> | -> | if <booliean expression> then
| | | <compound statement>
| |