Click here to return to the KiXtart HelpDesk main page...

KiXtart 2001 Manual

Select Case … EndSelect

Action: A SELECT statement is an efficient way to write a series of If-Endif statements.
 
Syntax: SELECT
  CASE expression
     statement1
     ....
  CASE expression
     statement2
      ....
ENDSELECT
 
Remarks: A SELECT statement consists of one or more conditions (CASE) each of which is followed by one or more statements that are executed only if the condition evaluates to TRUE. The SELECT statement is processed from top to bottom. If an expression evaluates to TRUE, the statements immediately following it are executed, up to the next CASE statement.

Only one CASE statement is executed, regardless of how many statements evaluate to TRUE.

If expression does not contain any relational operators, the condition is considered to be true if it is numeric and if it evaluates to a value other than zero, or if it is alphanumeric and it evaluates to a string containing at least one character.

SELECT statements can be nested as many times as memory allows.
 
See Also: If Else Endif
 
Examples:

SELECT
  CASE InGroup("Domain Admins") AND @DAY = 1
    ? "Whatever…"
  CASE InGroup("Office Users")
 
  ? "Etc…"
    ? "Etc…"
  CASE 1
   
; this is a nice way to provide a default CASE
    ; if all other
CASEs fail, this one will always be run
   ? "Hmm, you're not in one of our groups?"
ENDSELECT