Bernard Helyer:

> You could wrap the loop in an if clause:
> 
>     if (condition) while (true) {
>         // ...
>     } else {
>         // ...
>     }

This is the semantics of the else clause of Python for (and while) loops:

bool broken = false;
for (...) {
    if (...) {
        broken = true;
        break;
    }
}
if (!broken) {
 ...
}

I agree with BCS in the bug 2304, I'd like something more semantically 
descriptive instead of just an "else".
It's handy, I use it now and then in Python, but I am able to live without it 
in D.

Bye,
bearophile

Reply via email to