Progress
Language Tutorial
for Character
Using the CASE Statement
Another means of conditional control is the CASE statement. Use the CASE statement when you want to test the result of an expression against several values. You could use nested IF statements, but the CASE statement is much clearer.
This is the syntax for CASE.
Follow these steps to see how a CASE statement and a selection list can work together:
- Open
lt-06-05.p
and run it. The display shown below appears:
![]()
The selection list allows you to choose a chapter. A short description of the chapter then appears in the editor widget.
- Use ¦ and Ø to move the highlight bar in the selection list.
- Choose Exit, then press SPACEBAR to return to the Procedure Editor.
This is code that created the display:
These notes help explain the code:
- This DEFINE VARIABLE sets up the editor widget.
- This DEFINE VARIABLE statement sets up the selection list using the VIEW-AS phrase.
- This syntax makes the screen value of the selection list the conditional expression of the CASE statement.
- For each value of the selection list, the branches of the CASE statement assign an appropriate value to the editor widget.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |