Shantal
Shantal

Reputation: 1

Illegal expression in a pascal program

My code below throws an exception. Why?

program Masquerade(input, output);
    Begin 
 var amount, count, money : integer;
 writeln ('Welcome to the Wonder True Masquerade Band');
 writeln ('Would you like to proceed? Yes/No');

 var choice : String;
 readln (choice);
End.

Throws the error: fatal: syntax error ";" expected but "identifier AMOUNT" found

Where should the semi-colon go?

Upvotes: 0

Views: 3825

Answers (1)

Al Kepp
Al Kepp

Reputation: 5980

Put begin after var.

I haven't used Pascal for years and don't have any compiler to test it, but it should be like this:

program Masquerade(input, output);
var
  amount, count, money : integer;
begin 
  writeln ('Welcome to the Wonder True Masquerade Band');
...

Upvotes: 5

Related Questions