case select with multiple options

Just starting out? Need help? Post your questions and find answers here.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

case select with multiple options

Post by blueznl »

currently, every case can only have 1 expression

select a
case 1
case 2
case 3
endselect

is it possible to get more expressions per case?

select a
case 1 , 2
case 3
endselect

it beats a long list of if / elseif / elseif / endif...
Justin
Addict
Addict
Posts: 958
Joined: Sat Apr 26, 2003 2:49 pm

Post by Justin »

Not possible. But now that we have the break command:

select a
case 1
case 3
;do something
break

case 5
;do something else
break
endselect

this doesn't work now because select/endselect exits when the first case evaluates to true. maybe Fred should modified it(C works this way), although case 1,3 looks better.
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

Using the break command would make the next version incompatible with the former versions. I tend to the proposed version with the ,
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

i'll post it to the wish list
Post Reply