Difference between revisions of "DO CASE"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=DO CASE=
 
 
 
==Class==
 
Applications
 
 
 
 
==Purpose==
 
==Purpose==
 
Multiple choice selection command
 
Multiple choice selection command
Line 33: Line 26:
  
 
==Description==
 
==Description==
The DO CASE command selects one course of action out of many alternatives.  The Recital/4GL evaluates each CASE <condition> in turn.  As soon as one of the conditions evaluates to true (.T.) the <commands> for that CASE are executed and any further case statements are ignored.  Following execution of the <commands>, the program continues after the ENDCASE statement.
+
The DO CASE command selects one course of action out of many alternatives.  Recital evaluates each CASE <condition> in turn.  As soon as one of the conditions evaluates to true (.T.) the <commands> for that CASE are executed and any further case statements are ignored.  Following execution of the <commands>, the program continues after the ENDCASE statement.
  
 
====OTHERWISE====
 
====OTHERWISE====
Line 41: Line 34:
 
If no CASE <condition> is .T., and there is no OTHERWISE statement specified, then control skips to the next command following the ENDCASE.
 
If no CASE <condition> is .T., and there is no OTHERWISE statement specified, then control skips to the next command following the ENDCASE.
  
CASE statements, as with all of the other Recital/4GL statements can be nested.  In other words, a CASE statement can contain further DO CASE commands.
+
CASE statements, as with all of the other Recital statements can be nested.  In other words, a CASE statement can contain further DO CASE commands.
  
  
Line 48: Line 41:
 
accept "Enter a command: " to command
 
accept "Enter a command: " to command
 
do case
 
do case
  case command = "BROWSE"
+
    case command = "BROWSE"
    browse
+
        browse
  case command = "DIR"
+
    case command = "DIR"
    dir
+
        dir
  otherwise
+
    otherwise
    set message to "Unknown command."
+
        set message to "Unknown command."
 
endcase
 
endcase
 
</code>
 
</code>
Line 59: Line 52:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Applications]]
 +
[[Category:Applications Commands]]
 +
[[Category:Looping Commands]]

Latest revision as of 14:04, 14 January 2010

Purpose

Multiple choice selection command


Syntax

DO CASE

CASE <condition>

[<commands>]

[CASE <condition>

[<commands>]]

[OTHERWISE

[<commands>]]

ENDCASE


See Also

@...MENU, DO WHILE, ICASE(), IF, IF(), IIF()


Description

The DO CASE command selects one course of action out of many alternatives. Recital evaluates each CASE <condition> in turn. As soon as one of the conditions evaluates to true (.T.) the <commands> for that CASE are executed and any further case statements are ignored. Following execution of the <commands>, the program continues after the ENDCASE statement.

OTHERWISE

If an OTHERWISE statement is present and no CASE <condition> evaluates to .T., the OTHERWISE <commands> are executed.

ENDCASE

If no CASE <condition> is .T., and there is no OTHERWISE statement specified, then control skips to the next command following the ENDCASE.

CASE statements, as with all of the other Recital statements can be nested. In other words, a CASE statement can contain further DO CASE commands.


Example

accept "Enter a command: " to command
do case
    case command = "BROWSE"
        browse
    case command = "DIR"
        dir
    otherwise
        set message to "Unknown command."
endcase


Products

Recital Server, Recital