Quote:
Originally Posted by Twinny
When you think about it, it's very similar to if/else. Starts at the first case and checks. If it's the case, it performs it then ends the whole script. If not, goes down. Once it meets it's case, doesn't have to evaluate any others.For the serverside part, it's just reading the case "example": but i'm not even sure if it's doing that =p
|
I know what switch does, and I would argue that it's not particularly similar to if/else.
What I was getting at is that say ChatBar calls onAction. The second one is weeding out right off the bat all parameters from ChatBar that could never be the case. Option one loops through each of the cases for everything passed from ChatBar, regardless of if it
might be a case. That is not particularly desired; it runs up CPU usage.