Quote:
Originally Posted by [HLF]Southclaw
You're confusing switch with if checks.
In switch cases you can do this
pawn Код:
switch(variable) { case 5, 6, 7, 8:DoSomething(); case 10..40:DoSomethingElse(); }
You have to use the variable you're checking each time you check a value in an if-statement
pawn Код:
if(variable == 4 || variable == 5 ... etc)
I used to be pretty lazy and wrote macros for this back in my early days:
pawn Код:
#define OR ||variable== if(variable == 5 OR 6 OR 7 OR 8) #undef OR
But hey, it worked!
|
Worked or not working??
Quote:
Originally Posted by [HLF]SouthClaw
One more thing about switch, you can only have static number checks so this isn't valid:
pawn Код:
new check_value = 4; switch(variable) { case 4, 5, 6:DoSomething(); case check_value:DoSomethingElse(); }
It will throw a "must be a constant expression; assumed zero" error.
|
I didn't get you.
Can you explain?
Btw the code which I posted is wrong or correct?
It worked for me before.