How do i use multiple statements to one case statement?

4.1k views Asked by At

So i'm using pascal, and i want to add multiple statements to one case. I tried this code but i get the error: "Error: Constant and CASE types do not match"

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


end;
1

There are 1 answers

0
kes On BEST ANSWER

Wrap compound statements in a begin and 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;