function switch code example
Example 1: switch function
var rand = Math.round(random(1,4));
switch(rand){
case 1: console.log("Chosen Number : 1");
break;
case 2: console.log("Chosen Number : 2");
break;
case 3: console.log("Chosen Number : 3");
break;
case 4: console.log("Chosen Number : 4");
default: break;
}
Example 2: switch statement
int x = Random.Range(0, 5);
switch(x){
case 0:
//preform action if x=0
break;
case 1:
//preform action if x=1
break;
//CONTINUE DOWN
}