select ...end select

BlitzMax Forums/BlitzMax Beginners Area/select ...end select

Am i correct i understanding that select ... end select will accept only 1 condition per case? EG it wont accept
select a
case <condition1> or <condition2)
end select

in blitz3d you could do:

select a
case 1,2,3
do stuff
case 4,5,6
do stuff
default
do stuff
end select

might work in blitzmax too, i haven't tried it yet.

Yeah, that works.

Can also use:
Select True
  Case a >= 1 and a <= 10
    'do stuff
  Case a >= 11 and a <=20
    'do some other stuff
End Select


hmmmmm - try this an let me know what you get ...
a=5
Select a
Case a=1,2,3
Print("1,2,3")
Case a>3 And a<=6
Print ("4 or 5")
End Select

scratch that last ... by using select TRUE rather than select a - it works! I hafta learn to follow directions better.

You can separate OR conditions using commas...

Select EventID()

Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE

End

Default

DebugLog CurrentEvent.ToString$()

EndSelect


This will end the program if either a window is closed, or the X is clicked on a game graphics window.

quote: You can separate OR conditions using commas...

thats good to know,thanks seb

Yep cheers seb, even though i did show that in my example :-)
Learn to follow directions :-)