[Implemented] multi case in select

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] multi case in select

Post by BackupUser »

Restored from previous forum. Originally posted by plouf.

i would like somethink like this to be legal


a = 4
Select a
case 1 or 2
False
case 3 or 4
True
EndSelect

And
a = 4
Select a
case 1..4 ; (1 up to 4)
True
CAse 5..8 ; the double dot in from pascal as is what i mean
false
endselect

christos
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by VPureBasic.
i would like somethink like this to be legal


a = 4
Select a
case 1 or 2
False
case 3 or 4
True
EndSelect

Christos Try This for the first one:

A = 4
Select A
Case 3 : Answer = False
Case 4 : Answer = False
Default : Answer = True
endSelect



And
a = 4
Select a
case 1..4 ; (1 up to 4)
True
CAse 5..8 ; the double dot in from pascal as is what i mean
false
endselect

And, do the same for this one:
A = 4
Select A
Case 1 : Answer = True
Case 2 : Answer = True
Case 3 : Answer = True
Case 4 : Answer = True
Default: Answer = False
endSelect

Roger




BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by plouf.

A = 4
Select A
Case 3 : Answer = False ; hey this is the way i write select
Case 4 : Answer = False ; loops too :wink:)
Default : Answer = True
endSelect

i know tha but what happened when is more than one ?
ie
Select a
case a 100 : true
case a > 1000 and a > 9999 : false
default : notfound
endselect


And, do the same for this one:
A = 4
Select A
Case 1 : Answer = True
Case 2 : Answer = True
Case 3 : Answer = True
Case 4 : Answer = True
Default: Answer = False
endSelect

same here
select a
case 76895..99901 : true ; an example :wink:)
case 25698..69873 : false
endselect

obviously i should make one more variable
if a > 1000 and a 76894 and a < 99900
secodnselectfisrtcase.w = 1
endif
but became a little more complex and my source
is already complex enouph :wink:)))




[/quote]


[/quote]
Post Reply