相关疑难解决方法(0)

我的if语句有什么问题?

我现在正在尝试探索pascal.我遇到了一些编译器错误.我写了一个if else if语句,如下所示:

  if ((input = 'y') or (input = 'Y')) then
    begin
      writeln ('blah blah');
    end;
  else if ((input = 'n') or (input = 'N')) then
    begin
      writeln ('blah');
    end;
  else
    begin
      writeln ('Input invalid!');
    end;
Run Code Online (Sandbox Code Playgroud)

它在第一次给我一个错误else:

";" 预期,但"ELSE"发现

我找了很多关于if语句的教程,他们就像我一样:

if(boolean_expression 1)then 
   S1 (* Executes when the boolean expression 1 is true *)

else if( boolean_expression 2) then 
   S2 (* Executes when the boolean expression 2 is true *)

else if( boolean_expression 3) then 
   S3 (* Executes …
Run Code Online (Sandbox Code Playgroud)

pascal if-statement freepascal

6
推荐指数
1
解决办法
590
查看次数

标签 统计

freepascal ×1

if-statement ×1

pascal ×1