foreach syntax

Timon Gehr timon.gehr at gmx.ch
Fri Jun 29 07:09:06 PDT 2012


On 06/29/2012 12:47 PM, Namespace wrote:
> A friend of mine ask me why D's foreach isn't like C#
>
> Means, why is it like
> int[] arr = [1, 2, 3];
>
> foreach (int val; arr) {
>

foreach(val; arr) {

> and not
> foreach (int val in arr) {
>
> which it is more intuitive.
>

To someone coming from C#, yes.

> I could give him no clever answer to, so maybe someone here knows the
> reasons.

Just because. This does not matter.


More information about the Digitalmars-d-learn mailing list