switch

C Scripting Language
Reference Manual
Version 4.4.0

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using the CSL executive
Language
   Comments
   Numbers
   Literals
   Var and const
   Operators
   Statements and blocks
   Program flow
      if
      switch
      while
      do
      for
   Trace facility
   Exception handling
   Functions
   Predefined identifiers
Directives
System library
String library
Math library
Regular expression lib.
File library
Database library
Async Communication
Registry/Profile handling
Windows control
C API
C++ Class Interface
CSL links
  
switch (expression-0)
{
  case expression-1: [statements]
  [case expression-2: [statements]]
  ...
  [case expression-N: [statements]]
  [default: statements]
}

expression-0 is compared with expression-1 ... expression-N. As soon as a match is found, all subsequent statements within the switch block are executed. The statements after default are executed if none of the previous expressions was matched.

Within the statements, break is used to leave the switch block premature.

Note that unlike C, expression-1 ... expression-N don't have to be constants.

  Copyright © IBK Landquart Last revision: 27.05.2002 << Back  Top  Next >>