Particle's Custom RPG

Assistance => Assistance & Feedback => Topic started by: DeathAdder on May 28, 2005 01:56 am CDT

Title: Proper syntax for switch$
Post by: DeathAdder on May 28, 2005 01:56 am CDT
I can't seem to find any info on this on the net...

Whats the proper syntax for using a switch$?
Title:
Post by: GStricto on May 28, 2005 02:03 pm CDT
Code: [Select]
switch(int) {
   case int1:
      code;
   case int2:
      code;
      break;
   default:
      break;
}

The switch only takes int variables that I am aware of.  If you do not use break at the end of the case, it will cascade through the rest of the cases after the first true case found.  Default is what will happen if none of the cases evaluate to be true.  If you already knew this and are asking in terms of Tribes (which seems likely), then I will tell you that I have never seen switch used or been able to make it work.  You are stuck with lines of if(num==1) etc.
Title:
Post by: DeathAdder on June 4, 2005 12:26 am CDT
Hey thanx man, Yea i've used a switch before in T1 codig i'm pretty sure... Might have been T2, meh, I'll make it work ^_^ Thanx for the info!!