YENGswitch
From OpenSimulator
(Difference between revisions)
Line 4: | Line 4: | ||
examples | examples | ||
− | switch (command) { | + | switch (command) |
− | + | { | |
− | + | case "turnleft": | |
+ | { | ||
+ | TurnLeft (); | ||
+ | break; | ||
+ | } | ||
+ | case "turnright": | ||
+ | { | ||
+ | TurnRight (); | ||
break; | 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); }