YENGswitch
From OpenSimulator
(Difference between revisions)
Line 1: | Line 1: | ||
switch can only work in integer expressions, or strings<br> | switch can only work in integer expressions, or strings<br> | ||
break, default and '...' are keywords used with it.<br> | break, default and '...' are keywords used with it.<br> | ||
+ | |||
+ | examples | ||
+ | |||
+ | switch (command) { | ||
+ | case "turnleft": { | ||
+ | TurnLeft (); | ||
+ | break; | ||
+ | } | ||
+ | case "turnright": { | ||
+ | TurnRight (); | ||
+ | break; | ||
+ | } | ||
+ | default: llOwnerSay ("dont know how to handle " + command); | ||
+ | } |
Revision as of 14:51, 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); }