在pascal程序中非法表达

0 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.
Run Code Online (Sandbox Code Playgroud)

抛出错误: fatal: syntax error ";" expected but "identifier AMOUNT" found

分号应该去哪里?

Al *_*epp 5

beginvar.

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

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

  • 究竟.你不能在pascal中的代码块中声明变量. (2认同)