select ...end select

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

delusan(Posted 2007) [#1]
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


(tu) sinu(Posted 2007) [#2]
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.


GfK(Posted 2007) [#3]
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



delusan(Posted 2007) [#4]
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


delusan(Posted 2007) [#5]
scratch that last ... by using select TRUE rather than select a - it works! I hafta learn to follow directions better.


SebHoll(Posted 2007) [#6]
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.


Dabz(Posted 2007) [#7]
quote: You can separate OR conditions using commas...

thats good to know,thanks seb


(tu) sinu(Posted 2007) [#8]
Yep cheers seb, even though i did show that in my example :-)
Learn to follow directions :-)