An IF...THEN...ELSE statement is used to execute one or more ABL statements, based upon a logical condition that evaluates to true.

Syntax

IF expression THEN { block | statement }
  [ ELSE { block | statement } ]

If the value of the condition following the IF keyword is true, the AVM executes the statement or statements following the THEN keyword. If you want to execute multiple statements, they must be contained in a DO block. A DO block begins with DO: and ends with END. You can add an ELSE keyword to your IF THEN statement to handle the false condition.

The following example code contains an IF THEN ELSE statement

DEFINE VARIABLE custRating AS CHARACTER NO-UNDO.
DEFINE VARIABLE balance as INTEGER NO-UNDO.

balance = 3000.

IF (balance <= 1000)
  THEN custRating = "A".
  ELSE DO:
       IF (balance <= 5000)
         THEN custRating = "B".
         ELSE custRating = "F".
  END.
	
MESSAGE "Customer has a rating of" custRating.
Running the code produces the following output:
Customer has a rating of B