Case Range Statement ..

Jesse Phillips jessekphillips at gmail.com
Tue Jul 7 22:03:07 PDT 2009


On Tue, 07 Jul 2009 17:17:48 -0400, Ali Çehreli wrote:

> Leandro Lucarella Wrote:
> 
>> Can you at least use:
>> case X:
>> ..
>> case Y:
>> 
>> in the examples/documentation/specs? I think most case X: .. case Y:
>> haters found that format pretty acceptable
> 
> I like that syntax too, but not a good idea to use in the Digital Mars
> code samples, because another one with an extra dot is already being
> used to mean "omitted lines of code":
> 
> case X:
> ...
> case Y:
> 
> Ali

:D That just gives reason not to use ... for a separator. I love it.

I can definitely see this as a misguided step for a new user.

"A case range can be used like:

switch (i)
{
    case 1:
    ..
    case 3:
        x = 4;
        break;
}"

And the resulting code by the new user:

switch (i)
{
    case 1:
    case 2:
    case 3:
        x = 4;
        break;
}



More information about the Digitalmars-d mailing list