我想用开关,但我有很多情况下,有什么捷径吗?到目前为止,我知道并尝试过的唯一解决办法是:
switch (number)
{
case 1: something; break;
case 2: other thing; break;
...
case 9: .........; break;
}
What I hope I'm able to do is something like:
switch (number)
{
case (1 to 4): do the same for all of them; break;
case (5 to 9): again, same thing for these numbers; break;
}