The general form of the block-if structure is as follows:
IF( logical-expression ) THEN a block of statements ELSE IF( logical-expression ) THEN another block of statements ELSE a final block of statements END IFThe IF THEN, ELSE IF, and ELSE statements each govern one block of statements. There can be any number of ELSE IF statements. The ELSE statement (together with its block) is also optional, and there can be at most one of these.
The first block of statements is executed only if the first expression is true. Each block after an ELSE IF is executed only if none of the preceding blocks have been executed and the attached ELSE IF expression is true. If there is an ELSE block it is executed only if none of the preceding blocks has been executed.
After a block has been executed control is transferred to the statement following the END IF statement at the end of the structure (unless the block ends with some statement which transfers control elsewhere).
Any block can contain a complete block-IF structure properly nested within it, or a complete DO-loop, or any other executable statements (except END).
It is illegal to transfer control into any block from outside it, but there is no restriction on transferring control out of a block.
The rules for logical expressions are covered in section 7.7.