CaseIf

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
naw
Enthusiast
Enthusiast
Posts: 573
Joined: Fri Apr 25, 2003 4:57 pm

CaseIf

Post by naw »

Hi,
This would be nice:

Select X
*** caseif (X>100 and X<200): Debug "somewhere between 100 - 200" ***
case 150: Debug "150"
default: Debug "way off"
endSelect

- Oh Yes, and STDIN / STDERR support for PB4 would be fantastic :-)

Ta - N
Ta - N
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

Can't you use If and Elseif for pretty much anything you use select and case for. That would allow more complex statements. It seems to do roughly the same thing to me. I wonder if it gets converted to the same ASM, I'll have top check later.
naw
Enthusiast
Enthusiast
Posts: 573
Joined: Fri Apr 25, 2003 4:57 pm

Post by naw »

Yes of course, I just like to use Case Statements when I have long lists of statements -

long lists of if...then...else...elseif gets a bit messy & hard to follow (IMO)
Ta - N
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

If speed is important, do a time test on Select/Case -v- If/ElseIf.

I think you'll find If/ElseIf is faster.
@}--`--,-- A rose by any other name ..
Post Reply