Unconditional loop exists

bearophile bearophileHUGS at lycos.com
Tue Aug 13 08:32:03 PDT 2013


Timon Gehr:

> Well, the following is the most generic way to get the first 
> element of some iterable:
>
> foreach(x;s) return x;

I think I have not used that idiom even with opApply, but it's 
acceptable code. And perhaps someone will find a use case even 
for the unconditional loop break.

So I think this little idea-proposal is already closed :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list