Operators in switch statements? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Operators in switch statements? (
/showthread.php?tid=565279)
Operators in switch statements? -
Derexi - 26.02.2015
Is it possible to use operators (<, >, >= etc.) in switch statements? For example, you might want to do something like
but obviously that doesn't work. Is there a way, or do I just have to use if statements?
Re: Operators in switch statements? -
awoo - 26.02.2015
I don't think so, but you can do something like this:
Код:
case 0 .. 10:
case 11 .. 40:
Re: Operators in switch statements? -
Schneider - 26.02.2015
You could use negative numbers and/or a default statement..
pawn Код:
case -22..-14:
case -13..-1:
case 0..1:
case 2..5:
default: