Difference between revisions of "ICASE()"

From Lianjapedia
Jump to: navigation, search
 
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to execute an immediate case statement
 
Function to execute an immediate case statement
 
  
 
==Syntax==
 
==Syntax==
 
ICASE(<expL1>, <exp1>[, <expL2>, <exp2>] [,…] [, <exp-otherwise>)
 
ICASE(<expL1>, <exp1>[, <expL2>, <exp2>] [,…] [, <exp-otherwise>)
 
  
 
==See Also==
 
==See Also==
 
[[DO CASE]], [[IF]], [[IF()]]
 
[[DO CASE]], [[IF]], [[IF()]]
 
  
 
==Description==
 
==Description==
 
The ICASE() function operates as an immediate DO CASE statement.  It evaluates the specified conditions <expL1> to <expLn> and returns the matching expression <exp1> to <expn> for the first condition that evaluates to True (.T.).  If none of the conditions evaluates to True, the 'otherwise' expression, <exp-otherwise>, is returned.  If there is no otherwise expression specified, and none of the conditions evaluates to True, ICASE() returns a null (.NULL.).
 
The ICASE() function operates as an immediate DO CASE statement.  It evaluates the specified conditions <expL1> to <expLn> and returns the matching expression <exp1> to <expn> for the first condition that evaluates to True (.T.).  If none of the conditions evaluates to True, the 'otherwise' expression, <exp-otherwise>, is returned.  If there is no otherwise expression specified, and none of the conditions evaluates to True, ICASE() returns a null (.NULL.).
 
  
 
==Example==
 
==Example==
Line 22: Line 18:
 
  "Set message to [Unknown command.]"))
 
  "Set message to [Unknown command.]"))
 
</code>
 
</code>
 
  
 
==Products==
 
==Products==

Latest revision as of 12:42, 11 December 2012

Purpose

Function to execute an immediate case statement

Syntax

ICASE(<expL1>, <exp1>[, <expL2>, <exp2>] [,…] [, <exp-otherwise>)

See Also

DO CASE, IF, IF()

Description

The ICASE() function operates as an immediate DO CASE statement. It evaluates the specified conditions <expL1> to <expLn> and returns the matching expression <exp1> to <expn> for the first condition that evaluates to True (.T.). If none of the conditions evaluates to True, the 'otherwise' expression, <exp-otherwise>, is returned. If there is no otherwise expression specified, and none of the conditions evaluates to True, ICASE() returns a null (.NULL.).

Example

accept "Enter a command: " to command
&(icase(upper(command) = "BROWSE", "browse",;
 upper(command) = "DIR", "dir",;
 "Set message to [Unknown command.]"))

Products

Lianja Server, Lianja