Why is there no error?

In the following code a semicolon after write(c) is missing and an error is not reported. Why is there no error;

program ok;
var c:char;
begin
for c := 'a' to 'z' do
begin
write(c)
end;

Comments

  • because pascal allow this...... =)

    enum type is also allowed.

  • : In the following code a semicolon after write(c) is missing and an error is not reported. Why is there no error;
    :
    : program ok;
    : var c:char;
    : begin
    : for c := 'a' to 'z' do
    : begin
    : write(c)
    : end;
    :

    I dont know the reason behind this, but the last line before END; (or END.) doesnt have to have a semicolon. Its good practice to put it in anyway, but as you've found out, not necessary.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories