if
condition then
sequence_of_statements
{elsif
condition then
sequence_of_statements}
[else
sequence_of_statements]
end if
;
condition ::= boolean_expression
if
, and any conditions specified after elsif
, are evaluated in succession (treating a final else
as elsif
TRUE then
), until one evaluates to TRUE or all conditions are evaluated and yield FALSE. If one condition evaluates to TRUE, then the corresponding sequence of statements is executed; otherwise none of the sequences of statements is executed.
if
MONTH = DECEMBER and
DAY = 31 then
MONTH := JANUARY;
DAY := 1;
YEAR := YEAR + 1;
end if
;
if
LINE_TOO_SHORT then
raise
LAYOUT_ERROR;
elsif
LINE_FULL then
NEW_LINE; PUT(ITEM);
else
PUT(ITEM);
end if
;
if
MY_CAR.OWNER.VEHICLE /= MY_CAR then
-- see 3.8
REPORT ("Incorrect data");
end if
;