Lasso Soft Inc. > Home

[Case]

The [Case] tag is used to define one possible outcome from [Select] ... [/Select] tags. If the value specified in the opening [Select] tag matches the value for the [Case] tag then the code until the next [Case] tag is executed.

If a [Case] tag is specified without a value then it is the default case and will be executed only if no other [Case] in the current [Select] ... [/Select] tags is matched.

  • Syntax
  • Parameters
[Select: 'Select Value']
  [Case: 'Case 1 Value']
    ... Case 1 Code ...
  [Case: 'Case 2 Value']
    ... Case 2 Code ...
  [Case]
    ... Default Code ...
[/Select]
Optional Parameters
Case Value The value of the current case. If no value is specified then the case represents the default case.
Examples

To select one option based on the value of a variable:

Use the [Select] ... [Case] ... [/Select] tags. The opening [Select] tag accepts a variable that contains a value. The code which is after the first enclosed [Case] statement which matches the variable's value is executed. In the example below a 'color' variable is matched against several color names. If there is no match a default of black or #000000 is used.

[Variable: 'color'='green']
[Select: $color]
  [Case: 'red']
    [Output: '#ff0000']
  [Case: 'green']
    [Output: '#00ff00']
  [Case: 'blue']
    [Output: '#0000ff']
  [Case]
    [Output: '#000000']
[/Select]
Result:
#00ff00

To select one option based on the value of a variable:

Use the [Select] ... [Case] ... [/Select] tags. The opening [Select] tag accepts a variable that contains a value. The code which is after the first enclosed [Case] statement which matches the variable's value is executed. In the example below a 'color' variable is matched against several color names. If there is no match a default of black or #000000 is used.

Result:
#0000ff
Tag Link [Case] Category Conditional
Type Process Data Source Any
Support Preferred Version 6.0
Output Type None Security Tag
Implementation Internal Sets Lasso 7.0, Lasso 6.0

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft