小编mpo*_*l48的帖子

这个if else语句有什么问题?

我和Ada一起工作,控制声明上缺少括号让我有点混乱.我写了以下if-else语句:

if i = 1 then
    largest := nextInteger;
else if i = 2 then
    if nextInteger > largest then
        secondLargest := largest;
        largest := nextInteger;
    else
        secondLargest := nextInteger;
    end if;
else
    if nextInteger > largest then
        secondLargest := largest;
        largest := nextInteger;
    else if largest > nextInteger and then nextInteger > secondLargest then
        secondLargest := nextInteger;
    end if;
end if;
Run Code Online (Sandbox Code Playgroud)

我得到的错误消息是:

program_one.adb:15:05: missing "end if:" for "if" at line 3
program_one.adb:15:05: missing "end if;" for "if" at line …
Run Code Online (Sandbox Code Playgroud)

if-statement nested ada

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

标签 统计

ada ×1

if-statement ×1

nested ×1