CaseStatement specification issue

Baz via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 14 09:01:03 PDT 2014


On Thursday, 14 August 2014 at 13:19:36 UTC, Sergey Kozyr wrote:
> Sorry for previous message. Once again:
>
> I was reading D language reference and found some issue with
> "case ... :" statement specifications.
> Documentation http://dlang.org/statement#CaseStatement  says
> that after
>
> case 1:
>
> must be non-empty statement "ScopeStatementList". For example
>
> case 1:
>   return true;
>
> case 2: {
> }
>
> case 3: ;
>
> But next example concerns me:
>
> case 1:
> case 2:
>   return true;
> case 3:
>   return false;
>
> After "case 1:" we see no statement at all. This conflicts with 
> "CaseStatement" rule of documentation. But this is right D code.
> I think language reference must be updated.

It's a "fall trough":

https://en.wikipedia.org/wiki/Switch_statement#Fallthrough



More information about the Digitalmars-d mailing list