[Implemented] Better CASE

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

[Implemented] Better CASE

Post by RichardL »

The Pure Basic case statement is a liitle restrictive.
GFA did it better.

I would love to have...

Select Time.l

case 0 to 100
do something

case 110,117,119
do something else

EndSelect
Sunny
User
User
Posts: 16
Joined: Wed Feb 04, 2004 7:46 pm
Location: Germany | Hannover

Post by Sunny »

jeah, I also think that is a nice feature. In Delphi it is done like that, I think:

case [0..100]

For PB it would be nice to have a syntax like that:

case 0 to 100 (as RichardL said)
or
case 0 ... 100
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

This would be a nice useful addition to have, I think the "Case 0 to 100" syntax suits PB better, similar to the for next loop.
Mark my words, when you least expect it, your uppance will come...
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Post by RichardL »

In my originla post

case 110,117,119

means "any of the items listed"

GFA also provides for

CASE 10 TO 20, 32,34

and

CASE "FRED", "TIM"

My personal view is that a cacade of ELSEIF does the job but CASE is much neater.
ROUMANET
User
User
Posts: 12
Joined: Thu Aug 26, 2004 9:18 pm
Location: Isere (France)

Same request for me

Post by ROUMANET »

I hope for the same thing... it's just a syntaxic problem, not compiler problem.
Kazmirzak
User
User
Posts: 92
Joined: Fri Jun 18, 2004 5:44 pm
Location: Germany

Post by Kazmirzak »

I agree :wink:
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

Post by MadMax »

Yes would be nice to have this added

I would vote for the following syntax:

Case 12 .. 23 instead of "12 to 23"

Case 10,20,34,56 Seems fine.

Would like also

Case <33

Case >67

Case <57 AND >87


And these sort of combinations.
Post Reply