How can I define a label inside a switch?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 14 11:02:42 PST 2014


On Sun, 14 Dec 2014 18:48:15 +0000
Meta via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

> On Sunday, 14 December 2014 at 18:41:54 UTC, MachineCode wrote:
> > The labels are disabled then? I find that goto case case_value 
> > ugly and prefer goto labelName; but if it's the only way to go 
> > let's do it
> 
> I'm not sure if it's intentionally not supported, or just an 
> oversight. Probably the former, so you should use "goto case". I 
> agree it is annoying having to type out the expression for which 
> case to go to; I can't remember if there was any rationale given 
> for disallowing such a case.

i believe that this is just an oversight. technically that label
belongs to the previous case, so that case is assumed to have some code
after `break` or `goto`, even if there is no real code follows. not
sure if it worth fixing though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141214/a8777a3c/attachment-0001.sig>


More information about the Digitalmars-d-learn mailing list