foreach ... else statement

Don nospam at nospam.com
Mon Jan 5 00:44:06 PST 2009


bearophile wrote:
> 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.

Actually Walter loves goto, so DMD copes really well with it.



More information about the Digitalmars-d mailing list