switch
This function acts like the switch statement in C-like programming languages. It takes the value argument and compares it to each of the case1 through caseN expressions. If value is equal to caseX , then switch returns valueX . If value is not equal to any of the case1..N , then returnDefault is returned.
Note that switch() is similar in functionality to the case() expression function . The difference between the two is the order in which the parameters are passed.
switch( value, case1, ...caseN, return1, ...returnN, returnDefault )
//The following would return 46 because the value (15) matched case 3, so the third return (46) was returned.switch(15, // value1, // case 124, // case 215, // case 344, // return 145, // return 246, // return 3-1) // default //The following would return "Running".switch(1, // value0, 1, 2, // cases 1-3"Off", // return 1"Running", // return 2"Fault", // return 3forceQuality("!BAD STATE!",0)) // default