YENGswitch

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
Line 4: Line 4:
 
examples
 
examples
  
  switch (command) {
+
  switch (command)
      case "turnleft": {
+
{
          TurnLeft ();
+
    case "turnleft":
 +
    {
 +
        TurnLeft ();
 +
        break;
 +
    }
 +
    case "turnright":
 +
    {
 +
        TurnRight ();
 
           break;
 
           break;
      }
+
    }
      case "turnright": {
+
    default: llOwnerSay ("dont know how to handle " + command);
          TurnRight ();
+
}
          break;
+
      }
+
      default: llOwnerSay ("dont know how to handle " + command);
+
  }
+

Revision as of 14:58, 19 September 2020

switch can only work in integer expressions, or strings
break, default and '...' are keywords used with it.

examples

switch (command)
{
    case "turnleft":
    {
        TurnLeft ();
        break;
    }
    case "turnright":
    {
        TurnRight ();
          break;
    }
    default: llOwnerSay ("dont know how to handle " + command);
}
Personal tools
General
About This Wiki