[Gambas-user] check a range of values for select case

Grahame White grahame at ...457...
Sun May 16 15:53:10 CEST 2004


I'm porting over some old VB programs I wrote many years ago as a way of 
familiarising myself with Gambas a bit better and also as a way see how 
things are done differently.

Currently I'm working on a piece of cod that has a select case something 
like this

dim some_number as integer

select case some_number
	case 0
		' do stuff
	case 1 to 9
		' do other stuff
	case 10 to 500
		' something else again
	case else
		' everything else
end select



I've been looking through some of the examples and they have something 
similar but not quite as easy to use. Is this the only way :

dim some_number as integer

select case some_number
	case 0
		' do stuff
	case 1,2,3,4,5,6,7,8,9
		' do other stuff
	case 10,11,<snip>,499,500
		'something else again
	case else
		' everything else
end select


having to explicitly specify *every* value required to enter a case is not 
very helpful, especially for large number ranges :)

Grahame




More information about the User mailing list