ID:269268
May 3 2005, 3:35 pm
|
|
I'm learning to program, and I don't understand the switch statement. I mean I under stand switch(input, but not like switch in the middle of a proc. So when, and where I it appropriate to use switch?
|
May 3 2005, 3:39 pm
|
|
you use the switch statment in several cases
|
Switch.
Basically you want to use switch when you've got a lot of possible outcomes for a paritcular statement. Ie, if the player just selected their class and you want to give each class a different icon, stats, etc. |
In response to Jay1
|
|
Here is a little sample verb...
mob This should be right. |
In response to XxDragonFlarexX
|
|
While that would work, it's definantly not the greatest use of switch statements.
For example, you aren't giving the player any choice in a lot of those alerts, so it's pointless to do an if statement of any sort. For example, instead of putting: switch(alert(usr,"You changed your mind...","Choice","Ok")) You could put: alert(usr,"You changed your mind...","Choice","Ok") My sisters house just got broke into, so I'll have to cut this short for now. |