Switch cases.

Is there any way that I can include a range of numbers in each switch case, like 80-89?
Not really. The closest you can do is one of these:

1
2
3
4
case 80: case 81: case 82:  ...
case 89:
  // ...
  break;


or put it in an if() in the default:

1
2
3
default:
if( (x >= 80) && (x <= 89) )
  // ... 
Topic archived. No new replies allowed.