ID:266699
 
quick question about switch(rand(1,30))
Well I never really looked up switch in the ref before so I decided to do it because I thought it could be the cause to why my proc wasn't working...

and it says ...
"The "switch" instruction is a compact notation for a lengthy "else-if" chain."

else-if

so that means if I had an if() statement before the switch and it was true it would call it and not call the switch?
just a possibility?

is there any other way to do this...

switch(rand(1,30))
if(1,10)
if(11,12)
etc?
is there any other way to do this...

switch(rand(1,30))
if(1,10)
if(11,12)
etc?

There is an example of this in the reference but if you wanted you could do: something to something. Example:

switch(rand(1,30))
if(1 to 10)
//blah
if(11,12)
//blah


The first uses a range and the second uses specific values.
In response to tenkuu
weird!!!

because puting 1,10 used to mean 1 to 10, or atleast that's how it used to work!! Weird...
ok cool thanks
In response to Jon Snow
Jon Snow wrote:
because puting 1,10 used to mean 1 to 10, or atleast that's how it used to work!! Weird...

if(1,10) in a switch command has always meant if it was 1 or 10, never if it was inclusively between 1 and 10.