'Switch' number ranges

Kieron_59
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
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
Ok, I'll do that. Thanks.

jaynabonne
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.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums