- program echo;
- var
- msg1:string;
- begin
- readln(msg1);
- writeln(msg1);
- readln;
- end.
snoop.pas
city
| 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
| |
- IF <logical expression> THEN
- <Pascal code for "true" situation>
- ELSE
- <Pascal code for "false" situation>
- IF response = 'yes' THEN
- BEGIN
- writeln('suspect gas');
- END
- ELSE
- BEGIN
- writeln('suspect battery');
- END;
response come from?
BEGIN ... END ?
- BEGIN
- <Pascal Statements>;
- ...
- <Pascal Statements>;
- END
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.');