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

Benoit Minisini gambas at ...1...
Sun May 16 20:10:43 CEST 2004


On Sunday 16 May 2004 15:53, Grahame White wrote:
> 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
>
>

You must use IF/ELSE IF/ENDIF to do what you want.

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list