: : : : : : : Try "HALT" or "EXIT"
: : : : : : :
: : : : : :
: : : : : : If I write one of them I get an error.
: : : : : :
: : : : : What error are you getting? What compiler are you using?
: : : : :
: : : : :
: : : :
: : : : I'm not getting any error. It's just not stopping after if finds the
: : : : 0 in the beggining.
: : : :
: : : : And I'm using TPW7.
: : : :
: : : Can you post the code that doesn't stop?
: : :
: :
: :
: : PROGRAM first;
: : USES WINCRT;
: : VAR
: : L:integer; {Left}
: : R:integer; {Right}
: : M:integer; {Middle}
: : T:integer; {Temporary}
: : BEGIN
: : writeln('There are three letters on a desk.');
: : writeln('One at the left side. One at the middle, and one at the right side of the desk.');
: : writeln('On each letter there is a number.');
: : writeln('The purpose of this program is: ');
: : writeln('Make the 0 numbered letter be placed at the middle.');
: : writeln('');
: : writeln('Please enter the number of the left letter');
: : readln (L);
: : writeln ('Please enter the number of the right letter');
: : readln (R);
: : writeln ('Please enter the number of the middle letter');
: : readln (M);
: : T:=R;
: : R:=M;
: : M:=T;
: : writeln ('');
: : writeln ('Here are the numbers after one switch: ');
: : writeln ('Left: ',L);
: : writeln ('Right: ',R);
: : writeln ('Middle: ',M);
: : if (M=0) then
: : writeln ('The 0 is now at the middle')
: : EXIT {or HALT? I also tried with ; and . after but it didn't work}
: : else
: : T:=L;
: : L:=M;
: : M:=T;
: : writeln ('');
: : writeln ('Here are the numbers after two swithces: ');
: : writeln ('Left: ',L);
: : writeln ('Right: ',R);
: : writeln ('Middle: ',M);
: : writeln ('The 0 is now at the middle');
: : END.: :
: :
:
:
Are you saying that this code compiles? I would not expect it to due to there being no semicolon after the writeln statement in the IF construct. On my computer it does not compile.