Understanding switch + foreach

Matej Nanut matejnanut at gmail.com
Wed Apr 16 16:21:12 PDT 2014


Well, I'm still confused by this. I also noticed that the compiler
doesn't complain if I omit the break statements in the generated
switch, but complains normally if I write it out like so:

```
    switch (key)
    {
        case 1: "Found 1!".writefln();
                break;
        case 2: "Found 2!".writefln();
                break;
        case 3: "Found 3!".writefln();
                break;
        case 4: "Found 4!".writefln();
                break;
        case 5: "Found 5!".writefln();
                break;
        default:
                "Not found %s :(".writefln(key);
                break;
    }
```


More information about the Digitalmars-d-learn mailing list