ILE COBOL Language Reference

Nested IF Statements

The presence of one or more IF statements within the initial IF statement constitutes a "nested IF statement". Nesting statements is much like specifying subordinate arithmetic expressions enclosed in parentheses and combined in larger arithmetic expressions.

IF statements contained within IF statements are considered as paired IF, ELSE, and END-IF combinations, proceeding from left to right. Thus, any ELSE or END-IF encountered is considered to apply to the immediately preceding IF that has not been already paired with an ELSE or END-IF.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]