Closing if-loops by "endif" vs. "end if"

We need a way of differentiating between the different meanings of END.

In Fortran 77, “… an END statement is also an executable statement and must appear only as the last statement of a program unit”.

Modern Fortran does not require the keywords PROGRAM, SUBROUTINE, etc., after an END statement that terminates a program unit. How do you then differentiate between an END statement that means “return” and an END statement that ends an IF block, etc.?

1 Like