pascal 程序中的非法表达式

发布于 2024-10-14 08:29:38 字数 357 浏览 4 评论 0原文

我下面的代码抛出异常。为什么?

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.

抛出错误:致命:语法错误“;”符合预期,但发现“标识符 AMOUNT”

分号应该放在哪里?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飞烟轻若梦 2024-10-21 08:29:38

begin 放在 var 之后。

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

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

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');
...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文