Try OpenEdge Now
skip to main content
ABL Essentials
Using Basic ABL Constructs : Defining an IF-THEN-ELSE decision point

Defining an IF-THEN-ELSE decision point

You will notice when you run your procedure that some of the ship dates are not defined. Some of these Orders apparently have been on hold for a very long time! Let's construct a statement to branch in the code depending on whether the ShipDate field is defined or not. ABL, like most languages, has an IF-THEN construct for such decision points. It can also have an ELSE branch:
IF condition THEN { block | statement }[ ELSE { block | statement }]
The condition is any expression that evaluates to TRUE or FALSE. Following the THEN keyword, you can place a single ABL statement or a whole set of statements that are all to be executed if the condition is TRUE. The way to represent a block that simply groups a series of statements together that are all executed together is a DO-END block:
IF condition THEN DO:
If you include the ELSE keyword followed by a statement or a block of statements, that branch is taken if the condition evaluates to FALSE.
* Using the ABL Unknown value
* Using built-In ABL functions
* ABL Functions