If there exist multiple conditions, the switch statement is suggested. It is because only one expression gets evaluated depending on which control jumps directly to the respective case.
switch(myVar) {
case 1:
//if myVar is 1 it is executed case 'sample':
//if myVar is 'sample' (or 1, see the next paragraph)
//this is executed case false:
//if myVar is false (or 1 or 'sample', see the next paragraph)
//this is executed default:
//if myVar does not satisfy any case, (or if this is
//1 or 'sample' or false, see the next paragraph)
//this is executed
}
As illustrated in this code, depending on the value of "myvar", the statement of the respective case gets executed. If case is satisfied, the code ahead of that case will also be executed unless the break statement is utilized. In the above instance, if myVar is 1, the code for case 'false', case 'sample' & 'default' will all be executed as well.