Your syntax for trying to do a range with switch/case is wrong.
case 1 - 10:
will be translated to case -9:
There are two ways you can attempt to cover ranges (multiple values):
List the cases individually
case 1: case 2: case 3: case 4: case 5:
case 6: case 7: case 8: case 9: case 10:
return "Number is 1 through 10";
default:
return "Number is not 1 though 10";
Calculate a range
int range = (number - 1) / 10;
switch (range)
{
case 0: // 1 - 10
return "Number is 1 through 10";
default:
return "Number is not 1 though 10";
}
HOWEVER
You really should consider covering ranges of values with an if
statement
if (1 <= number && number <= 10)
return "Number is 1 through 10";
else
return "Number is not 1 through 10";