Game Development Community

Switch Case a,b do someting in scripts possible?

by elvince · in Torque 3D Professional · 04/10/2010 (11:02 am) · 2 replies

Hi all,

I would like to know if we can do something like
switch %i
{
case 0,10:
do something
case 30:
something else
}

instead of
switch %i
{
case 0:
do something
case 10:
do something
case 30:
something else
}
Thanks

#1
04/10/2010 (11:13 am)
Short answer: You can't.
Only one value can be checked with each case statement.

Depending on what you need it might be easier to use something like this:

if(%i == 0 && %i == 10)
{
   do something
}
else
{
   do something else
}
#2
04/10/2010 (11:24 am)
thanks for the confirmation. This was my initial thought, but just to be sure I asked :D