foreach syntax

Timon Gehr timon.gehr at gmx.ch
Fri Jun 29 09:14:37 PDT 2012


On 06/29/2012 06:09 PM, Namespace wrote:
> It wasn't my intention to start a syntax war. :D
> But i must agree, that "in" is a lot more readable as ";". Event ":" ist
> more readable as ";". But i just would know the real reason to this
> decision. Tanks to all. :)
> But why correct a few guys here my code?

It was more of a suggestion than a correction.

> foreach (int val; is the same as foreach(val; except that i like to
> write which type "val" is. Is that against the D nature or what?
>

It is redundant.

> P.S.: Which line must be changed to allow the "in2 syntax?
> Just out of pure interest. Thanks.

Search for TOKforeach in parse.c and change the TOKsemicolon's around 
there to TOKin's. If you want to allow both, that should be
straightforward as well.


More information about the Digitalmars-d-learn mailing list