Page 1 of 1

[Implemented] Better CASE

Posted: Sun Sep 12, 2004 9:48 pm
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

Posted: Sun Sep 12, 2004 11:50 pm
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

Posted: Mon Sep 13, 2004 12:04 am
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.

Posted: Mon Sep 13, 2004 8:03 am
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.

Same request for me

Posted: Wed Sep 15, 2004 8:40 am
by ROUMANET
I hope for the same thing... it's just a syntaxic problem, not compiler problem.

Posted: Wed Sep 15, 2004 9:31 am
by Kazmirzak
I agree :wink:

Posted: Thu Sep 16, 2004 1:43 am
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.