Define an IF-THEN-ELSE decision point
- Last Updated: October 6, 2023
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
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:
|
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 you include the ELSE keyword followed by
a statement or a block of statements, that branch is taken if the condition evaluates to FALSE.