IF x > 10 THEN y := 4 IF x > 10 THEN BEGIN y := 4;
ELSE y := 5; z := 5;
END
ELSE y := 5;
The ELSE clause always modifies the closest IF-THEN statement.
Use caution to avoid logic errors in nested IF statements, as in
the following:
IF A = 1 THEN {First IF}
IF B<>1 THEN {Second IF}
C := 1
ELSE {Appears to modify first IF}
C := 0; {Actually modifies second IF}