Statement IF Foundation
Executes one of several blocks of statements.
IF <lExpression1> <SourceCode>... [ELSEIF <lExpression2>] <SourceCode>... [ELSE] <SourceCode>... END[IF]
IF...ENDIF is a control structure used for program navigation. A program branches to the block of program statements following the first IF or ELSEIF statement, whose condition <lExpression> evaluates to .T. (true). The program executes up to the next ELSEIF, ELSE or ENDIF statement, after which execution branches to the next executable program line following the ENDIF statement. If all of the IF or ELSEIF defined conditions evaluate to .F. (false), control branches to the lines following the ELSE statement. If ELSE is not present, control branches to the lines following the ENDIF.
The number of ELSEIF conditions is unlimited. IF...ENDIF can also be deeply nested. Although different in syntax, the control structure is similar to the DO CASE...ENDCASE structure in its behavior.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.