Difference between revisions of "Command:Switch"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 25: Line 25:
  
 
== See Also ==
 
== See Also ==
*[[LavishScript:Control Structures]]
+
*[[LavishScript:Control Structures|Control Structures]]
 
*[[Command:Break|Break]]
 
*[[Command:Break|Break]]
 
*[[Command:Case|Case]]
 
*[[Command:Case|Case]]

Revision as of 01:31, 24 March 2005

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