Select/case question

BlitzMax Forums/BlitzMax Beginners Area/Select/case question

Galdy(Posted 2014) [#1]
Is there a way to use select-case so if the value is NOT the case it will execute the code inside of it. To Simplify the following?

If a<>1 and A<> 2 and a<> 3 and ......

To something like this. Which I know doesn't work.

Select a
Case not 1,2,3
Do something
Endselect

Just looking for a way to shorten the code if possible.


Floyd(Posted 2014) [#2]
A couple of possibilities:

a = 4

Select a
	Case 1,2,3  
		' Nothing happens here
	Default
		Print "Something other than 1,2,3"
End Select

a = 0

Select True
	Case a<>1 And a<>2 And a<>3
		Print "Again, not 1,2,3"
End Select



Galdy(Posted 2014) [#3]
Thanks, Wasn't aware of the default command.