foreach ... else statement

Christopher Wright dhasenan at gmail.com
Mon Jan 5 17:51:45 PST 2009


Nick Sabalausky wrote:
> bool isFound=false;
> foreach(char[] key, Foo f; fooAA)
> {
>     if(f.someFlag && key in barAA && f.someVal > barAA[key].someVal)
>     {
>         isFound = true;
>         break;
>     }
> }
> if(!isFound)
>     Stdout.formatln("Missing!");

foreach (a, b; aa)
    if (weLike(a, b)) goto found;
// else:
assert (false, "nothing we like!");
found:


I think my coworkers would kill me if I tried that.



More information about the Digitalmars-d mailing list