All control constructs can be both named and nested, for example,
outa: IF (a .NE. 0) THEN
x = b/a
inna1: IF (c .NE. 0) THEN
y = d/c
ELSE inna1
y = -99
END IF inna1
ELSE IF (a .GT. 0) THEN outa
CALL SUB1
ELSE outa
RETURN
END IF outa
Here the names are only cosmetic and are intended to make the code clearer (cf DO-loop names which do). If a name is given to the IF statement then it must be present on the ENDIF statement but not necessarily on the ELSE or ELSEIF statement. If a name is present on the ELSE or ELSEIF then it must be present on the IF statement.
The example has two nested and two named IF blocks. Nesting can be to any depth (unless the compiler prohibits this, even if it does the limit will almost certainly be configurable).
Even though construct names are only valid within the block that they apply to, their scope is the whole program unit. This means that a name may only be used once in a scoping unit even though no confusion would arise if it were re-used. (See Section 4.1.7 for a discussion of scope.)