Difference between revisions of "Command:Default"

From Lavish Software Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:
  
 
== Description ==
 
== Description ==
Used within a [[Command:Switch|Switch]], this marks the "default" case.  If no explicit cases match, this will be executed.  If no default is given and no explicit cases match, the execution would simply continue after the [[Switch:EndSwitch|EndSwitch]].
+
Used within a [[Command:Switch|Switch]], this marks the "default" case.  If no explicit cases match, this will be executed.  If no default is given and no explicit cases match, the execution would simply continue after the [[Command:EndSwitch|EndSwitch]].
  
 
== Examples ==
 
== 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 ==
 
== See Also ==
 +
*[[Command:Break|Break]]
 
*[[LavishScript:Commands|Commands]]
 
*[[LavishScript:Commands|Commands]]
 
{{Command-Stub}}
 
{{Command-Stub}}
 +
[[Category:LavishScript]]
 +
[[Category:LavishScript Commands]]

Latest revision as of 17:08, 24 August 2005

Syntax

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

Default

Description

Used within a Switch, this marks the "default" case. If no explicit cases match, this will be executed. If no default is given and no explicit cases match, the execution would simply continue after the EndSwitch.

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