foreach ... else statement

bearophile bearophileHUGS at lycos.com
Sun Jan 4 08:59:12 PST 2009


Brian:
> any chance we could see something like pythons else statement on 
> iterative loops in D (Might be useful on regular for loops too but not as 
> much)?
> http://docs.python.org/tutorial/controlflow.html#break-and-continue-
> statements-and-else-clauses-on-loops

It seems everyone has ignored this post, but this isn't a proposal coming from a clueless alien. Such "else" has a little but true purpose, it helps avoid gotos in some situations, and this in turn may help the optimizer, because I think gotos aren't much well digested by modern C/D compilers.

More on the topic:
http://leonardo-m.livejournal.com/2008/08/07/

Bye,
bearophile



More information about the Digitalmars-d mailing list