0

How would I create a switch statement where I want a case to be a range of values? For example, I want a case to be between the values of 1-100.

  • 7
    Does this answer your question? [Using switch statement with a range of value in each case?](https://stackoverflow.com/questions/10873590/using-switch-statement-with-a-range-of-value-in-each-case) – Puneeth G R Mar 22 '22 at 19:28
  • 1
    First question is *why use a switch statement for that?* Unless you can represent your ranges as a single value (such as using an enum), you should use an if block. – ernest_k Mar 22 '22 at 19:28

0 Answers0