switch statements

Started by , Tue 10/08/2004 20:24:41

Previous topic - Next topic

ozoneliar

Does Ags support switch statements ?  If so how are they used in ags? are they just like c?

Gilbert

no. you have to use nested if's.

ozoneliar

Nested ifs are messy and ineffecient compared to switch statements. Are there any plans to include it in future versions?  mabye I could write a function that will help.

Gilbert

It's on the to-do list, but I think it's not of high priority.

Radiant

If you must, you can do something with an array of structs, and search as per a binary tree. Scripts aren't particularly efficient, but then 95% of AGS's processor time is spent updating the screen, so it doesn't bother people even on a 300 MHz machine.

ozoneliar

Yes I suppose I could do that, but I was just looking for a ready made easy way to do it.

TerranRich

Not in AGS. It isn't important to CJ (Pumaman) because there's a workaround that we all use (if's).
Status: Trying to come up with some ideas...

SMF spam blocked by CleanTalk