Difference between revisions of "Command:Case"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 7: Line 7:
  
 
== Examples ==
 
== Examples ==
Switch "${Crayon.Color}"
+
Switch "${Crayon.Color}"
{
+
{
  case Red
+
  case Red
    echo "You picked the Red crayon"
+
      echo "You picked the Red crayon"
    break
+
    break
  case Yellow
+
  case Yellow
    echo "You picked the Yellow crayon"
+
      echo "You picked the Yellow crayon"
    break
+
    break
  case "Burnt Sienna"
+
  case "Burnt Sienna"
    echo "You picked the Burnt Sienna crayon"
+
      echo "You picked the Burnt Sienna crayon"
    break
+
    break
  Default
+
  Default
      echo "Please pick Red, Yellow, or Burnt Sienna"
+
      echo "Please pick Red, Yellow, or Burnt Sienna"
    break
+
    break
}
+
}
EndSwitch
+
EndSwitch
  
 
== See Also ==
 
== See Also ==

Revision as of 06:11, 2 April 2005

Syntax

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

Case <text>

Description

Used within a Switch, this marks the beginning of what should be executed if the text matches what was given to Switch.

Examples

Switch "${Crayon.Color}"
{
  case Red
     echo "You picked the Red crayon"
    break
  case Yellow
     echo "You picked the Yellow crayon"
    break
  case "Burnt Sienna"
     echo "You picked the Burnt Sienna crayon"
    break
  Default
      echo "Please pick Red, Yellow, or Burnt Sienna"
    break
}
EndSwitch

See Also