Open Userhunt opened 6 years ago
It is not a bug. You must use a ";" after "then" as an indication of no-op.
Program p; var a, b:integer; Begin readln(a); if (a=0) or (a=1) then ; else writeln('error'); writeln(a); end.
By the way, I was wrong in my last comment: "if false then else S;" where S is any statement is valid syntax in Pascal. And "if false then ; else S;" is invalid. So, it IS a bug. Actually, the application treats semicolons (;) in a very inconsistent way, as i just saw...
Program p; var a, b:integer; Begin readln(a); if (a=0) or (a=1) then else writeln('error'); writeln(a); end.
error - If a=0 then "the program should not do anything" else "the program should write error"