CASE statement
- Last Updated: October 29, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
The CASE statement provides a multi-branch
decision based on the value of a single expression. You can specify multiple conditions,
each with its own code, and execute the code when a condition is true. Each condition is
defined in a WHEN … THEN section. In addition, you can define an OTHERWISE section to handle any conditions that are not explicitly
defined.
Syntax
|
In the following code, the CASE statement is
used to assign the yearly quarter based on the month.
|
Running the code produces output similar to the following, depending on the current date:
|