Switch statement for greater-than/less-than

so I want to use a switch statement like this:

switch (scrollLeft) {
  case (<1000):
   //do stuff
   break;
  case (>1000 && <2000):
   //do stuff
   break;
}

Now I know that either of those statements (<1000) or (>1000 && <2000) won’t work (for different reasons, obviously). What I’m asking is the most efficient way to do just that. I hate using 30 if statements, so I’d rather use the switch syntax. Is there anything that I can do?

10 Answers
10

Leave a Comment