forlang.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
IF THEN ELSE (Block IF)
                                             Up Contents Index Back
─────IF THEN ELSE (Block IF) ───────────────────────────────────────────────
 
     Action
 
     Executes a block statement if <expression> is true. Transfers
     control to the next ELSE, ELSE IF, or END IF (of the same IF
     level) if <expression> is false.
 
     Syntax  IF (expression) THEN
 
     Parameter          Description
 
     expression         A logical expression
 
     Remarks
 
     The IF block consists of all the executable statements between
     the IF statement and the next ELSE IF, ELSE, or END IF statement
     at the same IF level.
 
     After execution of the last statement in the IF block, the next
     statement executed is the next END IF statement at the same IF
     level as the block IF statement.
 
     Transfer of control into an IF block from outside that block is
     not permitted.
 
     See Also:  ELSE
                ELSE IF
                END IF
 
     Examples
 
     C     Simple block IF that skips a group of statements
     C     if the expression is false:
           IF (i .LT. 10) THEN
     C     the next two statements are only executed if i < 10
              j = i
              slice = TAN (angle)
           END IF
 
     C     Block IF with ELSE IF statements:
 
           IF (j .GT. 1000) THEN
     C     Statements here are executed only if J > 1000
           ELSE IF (j .GT. 100) THEN
     C     Statements here are executed only if J > 100 and j <= 1000
           ELSE IF (j .GT. 10) THEN
     C     Statements here are executed only if J > 10 and j <= 100
           ELSE
     C     Statements here are executed only if j <= 10
           END IF
 
     C     Nesting of constructs and use of an ELSE statement following
     C     a block IF without intervening ELSE IF statements:
 
           IF (i .LT. 100) THEN
     C     Statements here are executed only if i < 100
           IF (j .LT. 10) THEN
     C     Statements here are executed only if i < 100 and J < 10
           END IF
     C     Statements here are executed only if i < 100 amd J < 10
           ELSE
     C     Statements here are executed only if i >= 100
           IF (j .LT. 10) THEN
     C     Statements here are executed only if i >= 100 and J < 10
           END IF
     C     Statements here are executed only if i >= 100
           END IF
                                    -♦-