IF ... ENDIF Command
Conditionally executes a set of commands based on the value of a logical expression.
Specifies the logical expression that is evaluated. If lExpression evaluates to true (.T.), any commands following IF or THEN and preceding ELSE or ENDIF (whichever occurs first) are executed.
If lExpression is false (.F.) and ELSE is included, any commands after ELSE and before ENDIF are executed.
If lExpression is false (.F.) and ELSE isn't included, all commands between IF and ENDIF are ignored. In this case, program execution continues with the first command following ENDIF.
CLOSE DATABASES OPEN DATABASE (HOME(2) + 'Data\testdata') USE Customer && Open customer table GETEXPR 'Enter condition to locate ' TO gcTemp; TYPE 'L' DEFAULT 'COMPANY = ""' LOCATE FOR &gcTemp && Enter LOCATE expression IF FOUND( ) && Was it found? DISPLAY && If so, display the record ELSE && If not found ? 'Condition ' + gcTemp + ' was not found ' && Display a message ENDIF USE