I'm working with Ada, and the lack of braces on the control statements have been getting me a bit mixed up. I have written the following if-else statement:
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;
The error message that I get is:
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 1
I'm struggling to find where I didn't close out an if statement. It's late and I've been working all day, so I may just be tired. Can anyone help?