0
Multiple Logical Check
I want to check if the value of var x is between 10 and 30. In if else statement it can be done with if(x > 10 && x < 30){} Can it be done by using switch statement?
1 Answer
+ 2
Yes, one example is,
switch (x > 10 && x < 30) {
case true:
// something here ;
break ;
default ;
// something here ;
}
P.S. default is like 'else' and the cases are 'if's.