Thunderstone Software Document Retreival and Management
Search:
Advanced Search
Home | Products | Company | News | Tech Support | Demos | Contact Us
Vortex Manual

SWITCH - multi-choice branch

 

SYNOPSIS

<SWITCH switchval>
  <CASE value1>
    ... statements if switchval = value1 ...
  <CASE op value2>
    ... statements if switchval op value2 is true ...
  ...
  <DEFAULT>
    ... statements if no <CASE> matches ...
</SWITCH>


DESCRIPTION
The SWITCH statement provides a multi-option branch based on a given value. The SWITCH value is compared against each CASE value, in the order they appear in the script, until one matches. The statements that follow, up to the next <CASE> tag or closing </SWITCH> tag, are executed. Only the first matching CASE, if any, is executed. If none of the CASEs match, then the statements after the <DEFAULT> tag, if present, are executed. If there is no <DEFAULT> tag, no statements are executed.

An optional operator can be given in a CASE to use in comparing its value to the SWITCH value, instead of the default eq. This can be useful in checking a range of values:


EXAMPLE

<SWITCH $temp>
  <CASE lte 32> Ice
  <CASE lt 60>  Cold water
  <CASE lt 100> Warm water
  <CASE lt 212> Hot water
  <DEFAULT>     Steam
</SWITCH>


CAVEATS
Similar to IF. Note that there is no </CASE> needed; execution doesn't fall through to the next CASE as in C. The DEFAULT clause, if present, must be last, since CASEs are checked in order of appearance.


SEE ALSO
IF


Copyright © Thunderstone Software     Last updated: Wed Sep 10 11:16:28 EDT 2008
 
Home   ::   Products   ::   Company   ::   News   ::   Tech Support   ::   Demos   ::   Contact Us
Copyright © 2008 Thunderstone Software LLC. All rights reserved.