switch (index,arg1,arg2...)
switch returns one of its arguments depending on the value of index. If index is 1, switch returns the first argument. If index is 2, switch returns the second argument, and so on. If index is 0 or greater than the total number of arguments, a null value is returned.
When used as a primitive, switch's first subobject specifies the index; subsequent subobjects specify the arguments. For illustration of such usage, see the example below.
//
// Use switch as a primitive.
// Start by defining an index variable.
//
int i;
//
// Define a switch.
//
switch x {
int index => i;
int val1 = 10;
int val2 = 20;
};
// Define an integer and connect it to switch x.
//
int result => x;