IF ... ENDIF Command

Example   See Also

Conditionally executes a set of commands based on the value of a logical expression.

Syntax

IF lExpression [THEN]
  Commands
[ELSE
  Commands]
ENDIF

Arguments

lExpression

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.

Remarks

You can nest an IF ... ENDIF block within another IF ... ENDIF block.

Comments preceded by && can be placed on the same line after IF, THEN, ELSE, and ENDIF. These comments are ignored during compilation and program execution.