Command:Switch

From Lavish Software Wiki
Revision as of 01:31, 24 March 2005 by Lax (talk | contribs)
Jump to navigation Jump to search

Syntax

Command Difficulty Rating
Switch
Usage Intermediate
Level of Understanding Intermediate
Computer Savvy Beginner
Logic Intermediate

Switch <text>

Description

Executes one of many conditional branches, depending on the value of the switch. Cases are checked for equality (case insensitive). The first case to match exactly will be executed. If no explicitly defined cases match, the Default, if any, will be executed. EndSwitch must be used to end the switch.

Examples

Switch ${Fruit.Color}
{
  case Red
    echo Is the fruit a strawberry?
    break
  case Blue
    echo Is the fruit a blueberry?
    break
  case Yellow
    echo Is the fruit a banana?
    break
  Default
    echo I don't know what kind of fruit might be ${Fruit.Color}!
    break
}
EndSwitch

See Also