switch()

Namespace rswhite4 at googlemail.com
Sun Feb 16 16:27:43 PST 2014


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;
}
----



More information about the Digitalmars-d mailing list