foreach syntax

bearophile bearophileHUGS at lycos.com
Fri Jun 29 04:01:52 PDT 2012


Namespace:
> A friend of mine ask me why D's foreach isn't like C#

In D you often omit the type:

foreach (val; arr) {

Using "in" is better for the human programmers. But D is largely 
designed to make D compilers too happy. I think Walter said that 
the semicolon was preferred because it simplifies the 
compiler/compilation a little.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list