Operators in switch statements?
#1

Is it possible to use operators (<, >, >= etc.) in switch statements? For example, you might want to do something like

pawn Код:
case < 1:
case 1:
case 2:
but obviously that doesn't work. Is there a way, or do I just have to use if statements?
Reply
#2

I don't think so, but you can do something like this:
Код:
case 0 .. 10:
case 11 .. 40:
Reply
#3

You could use negative numbers and/or a default statement..
pawn Код:
case -22..-14:
case -13..-1:
case 0..1:
case 2..5:
default:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)