how would you go about officially adding to the C++ language.
I am sure we all know about the select case function in BASIC. Now, C++ surpasses BASIC by far in all aspects, except for this one, I believe. And of course it is not essential, but it is nice.
I'm sorry, but C++'s switch statement just pales compared to BASIC's powerful select case. The reason for that is because switch requires constant values, while select case does not.
Now of course, there are ways you could build a library of your own to make some sort of make-shift select case for C++ if you wanted to, but would it not be possible to just go to ANSI and have the standard C++ switch statement changed to make it able to support things other than constants?
I liked the ability in basic to be able to do things like:
Now, of course you couldn't do that with the switch statement, it just is not possible, because it only accepts constants. Yes, you could do it using if statements, which is what we all do, but I just like the power of select case, and would like it to be equaled by C++'s switch.Code:
SELECT CASE x
CASE IS > 21 AND CASE IS < 35
CASE >= 35