'Switch' number ranges

Kieron_59
29 Jan 2013, 19:21
I was wondering if there was a shorter way of specifying a consecutive range of numbers for a 'Switch' command's key, or do I have to type each number one after the other like this: 1, 2, 3, 4?

BTownTKD
29 Jan 2013, 19:25
If you want to specify a range, you may want to use "if" statements, instead:

if(myVal >= 0 && myVal <= 5) // 0-5
{
//Do something
}
else if(myVal >= 6 && myVal <= 12) //6-12
{
//Do something else
}
//Etc.

Kieron_59
29 Jan 2013, 19:28
Ok, I'll do that. Thanks.

jaynabonne
30 Jan 2013, 12:27
Be sure you translate that into Quest language. :) (That looks quite C-like.)

Two main notes:

1) You must use "and" instead of "&&"
2) You have to have the opening '{' at the end of the "if" line, not on the next line.