Command:Switch
Jump to navigation
Jump to search
Contents
Syntax
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