Warcraft III resources & community, 2003–2006 · archived

"case"-function?

4 posts
#1

"case"-function?

Simple question:
Is there any similar function in JASS which checks different values of the same variable, such like the "switch/case"-function in C++:
---CODE---
switch (variable)
case possible value: code to execute;
case another possible value: code;
...
default: code;
break;
---/CODE---

I really like this statement although you can of course also do the same using different ifs...
So if there is any please describe how to use it! :)
#2
I have never seen a code using it and I havn't seen any hotkey to make them in text editors like I have seen hotkeys for if-statements.
#3

Re: "case"-function?

WaldbärSimple question:
Is there any similar function in JASS which checks different values of the same variable, such like the "switch/case"-function in C++:

switch ([i]variable[/i])
case [i]possible value[i]: [i]code to execute[/i];
case [i]another possible value[i]: [i]code[/i];
...
default: [i]code[/i];
break;


I really like this statement although you can of course also do the same using different ifs...
So if there is any please describe how to use it! :) [/i][/code]


I'm not sure what you're talking about, but if such a script exists you can most likely find it at The JASS Vault.
#4
I just saw that this italic writing doesn't work within a "code"-part... :? I changed it.

Well, my hope was very small, because I never saw it, but it was worth a try. 8)