If Else in Ada
Branching with if
and else
in Ada is straightforward.
To run the program, save it as if_else.adb
and use the Ada compiler:
Note that in Ada, you don’t need parentheses around conditions, but the then
keyword is required. The end if;
is used to close an if statement.
Ada uses elsif
for else-if conditions, and the and
and or
keywords for logical operators instead of symbols.
Ada doesn’t have a ternary operator, so you’ll need to use a full if
statement even for basic conditions.