I want to make a switch statement for in my code whose cases go over a wide span of integers (1-15000) split into 3 sections: 1-5000,5001-10000,10001-15000.
I tried it once like this:
switch(number) {
case 1 ... 1000: (statement here);
This gave me a syntax error on the "..."- "expected a :".
Then I tried:
switch (number) {
case 1:
case 5000:
(statement);
break;
This method did compile but didn't work as intended, wrong answer for the cases which were not explicitly listed.
Couldn't find any other suggestions online. Can anyone help?