在pascal程序中非法表达

时间:2011-01-27 19:21:33

标签: pascal

我的代码会引发异常。为什么呢?

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.

引发错误:fatal: syntax error ";" expected but "identifier AMOUNT" found

分号应该去哪里?

1 个答案:

答案 0 :(得分:5)

begin放在var之后。

我多年没有使用过Pascal,也没有任何编译器来测试它,但它应该是这样的:

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