switch()
Asman01
jckj33 at gmail.com
Mon Feb 17 15:04:23 PST 2014
On Monday, 17 February 2014 at 00:27:44 UTC, Namespace wrote:
> On Monday, 17 February 2014 at 00:22:52 UTC, Casper Færgemand
> wrote:
>> What about new evolved switch statement, called something as
>> to not confuse it with C syntax? It could be a simple rewrite
>> thing.
>>
>> mysteryswitch (some expression) {
>> case 1: some statement;
>> case 2 .. 4: some other statement;
>> }
>>
>> could rewrite to
>>
>> switch (some expression) {
>> case 1: some statement; break;
>> case 2: .. case 4: some other statement; break;
>> default: break;
>> }
>
> I like 'match' as Rust has:
> ----
> match (some expression) {
> case 1: some statement;
> case 2 .. 4: some other statement;
> }
> ----
+1, I linked this "match". How a name does the difference. I
suggest to implement this one instead of. I think that it's very
nice because don't make nobody confusing anymore or break D
philosofy. some-statement should have an implicit 'break'
generated by the compiler just like Pascal cases have (and rust I
guess)
More information about the Digitalmars-d
mailing list