1

所以我正在使用pascal,我想在一个案例中添加多个语句。我尝试了此代码,但出现错误:“错误:常量和 CASE 类型不匹配”

procedure pay;
begin
loop:=loop+1;
CASE loop OF
1: 
writeln('E-Mail: ');
readln(mailO[1]);
writeln('amount: ');
readln(amount[1]);


end;
4

1 回答 1

4

将复合语句包装在 abegin和中end

procedure pay;
begin
  loop:=loop+1;
  CASE loop OF
    1: 
       begin
         writeln('E-Mail: ');
         readln(mailO[1]);
         writeln('amount: ');
         readln(amount[1]);
       end;

   2:  writeln('simple statement');

   3:  begin
         writeln('something else');
         writeln('etc.');
       end;

  end;
end;
于 2014-12-17T23:17:10.870 回答