A switch statement in irScript has similar syntax and semantics to switch in C#:
var x = "some value";
switch( x )
{
case "some value":
x = 100.10;
break;
case "some other value":
x = 'Go away, or I will taunt you a second time';
break;
default:
throw 'Unexpected value: ' + x;
}
Note that the default case statement is always optional.
irScript supports fall-through case statements; that is, a case statement without an accompanying break statement will execute statements associated with any case or default statements below it, until a break statement is encountered or the switch statement ends.
Comments
0 comments
Please sign in to leave a comment.