So I recently learned about switch statements so I know that they are used as a replacement for if statements. For example,
if statement-
if (x == 1){do function(a)}
if (x == 2){do function(b)}
...
So, this can be written as-
switch(x){
case 1: do function(a);
case 2: do function(b);
}
But what if the if statement was-
if (x > 0){do function(a)}
else if (x < -10){do function(b)}
else{do function(c)}
How do we write this as a switch statement?