Allow multiple Select statement cases with Default

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Allow multiple Select statement cases with Default

Post by Mistrel »

We can do this:

Code: Select all

Select This
	Case a,b,c
	Default
EndSelect
So why can't we do this?

Code: Select all

Select This
	Case a,b,c
	Default,d
EndSelect
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Post by kenmo »

Unless I'm missing something, those two would perform exactly the same in any situation? What can't you do?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Allow multiple Select statement cases with Default

Post by PB »

> So why can't we do this?

Because "Default" means anything left over after all other cases are evaluated.
It would defeat the point of having a "Default" keyword if you could evaluate
other conditions with it.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Allow multiple Select statement cases with Default

Post by Little John »

Mistrel wrote:We can do this:

Code: Select all

Select This
	Case a,b,c
	Default
EndSelect
So why can't we do this?

Code: Select all

Select This
	Case a,b,c
	Default,d
EndSelect
kenmo is right:
In the first example, Default includes all cases apart from a, b, c. That means, Default does include case d. So there is no difference and no advantage in explicitely writing down case d, as in the second example.

Regards, Little John
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I'm not sure what I was thinking when I made this post. :oops:
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Mistrel wrote:I'm not sure what I was thinking when I made this post.
Chalk it up as a brian fart and move on. Happens to me all the time :wink:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

Sparkie wrote:
Mistrel wrote:I'm not sure what I was thinking when I made this post.
Chalk it up as a brian fart and move on. Happens to me all the time :wink:
Good thing my name isn't Brian :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Sparkie wrote:
Mistrel wrote:I'm not sure what I was thinking when I made this post.
Chalk it up as a brian fart and move on. Happens to me all the time :wink:
And also to me :lol:

Blue, you know :) no doubt he wanted to write "brain".
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Sparkie wrote:...Happens to me all the time.
See what I mean. :lol:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

Mistrel wrote:I'm not sure what I was thinking when I made this post.
Sparkie wrote:Chalk it up as a brian fart and move on. Happens to me all the time :wink:
BluezNL wrote:Good thing my name isn't Brian :-)
Psychophanta wrote:Blue, you know :) no doubt he wanted to write "brain".
Yeah, sorry, couldn't resist :oops: I seem to have a somewhat wacko sense of humor :wink:
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Yes, i did mean to type b r a i n. :lol:

[off_topic]

To be honest, it's becoming more and more difficult for me to function as a human lately due to my lack of b r a i n power. My abilities to focus and concentrate are dwindling and it's starting to show. :(

I went to the doctor earlier this week and he's pretty sure I have sleep apnea. I will find out for sure next week. It's been month's since I've had a good nights sleep.... I am SO looking forward to getting my b r a i n back to it's normal state where the brian farts are far and few between. 8)

[/off_topic]
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Post Reply