IF ... ENDIF Command

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

IF lExpression [THEN]
      Commands
[ELSE
      Commands]
ENDIF

Parameters

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.

  • 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.

Expand imageRemarks

Expand imageExample

Expand imageSee Also


© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic