DMD 1.019 and 2.003 releases

Walter Bright newshound1 at digitalmars.com
Mon Jul 23 10:18:05 PDT 2007


BCS wrote:
> what will this do
> 
> foreach(float f; 1 .. toBigFor1ToIncrement)
> 
> loop forever?

The same thing as:

	for (float f = 1; f < toBigFor1ToIncrement; f++)

What foreach ranges buy you is:

1) The type of the loop index is automatically inferred
2) The termination condition is evaluated only once

While these may seem trivial, they are often a source of bugs.



More information about the Digitalmars-d-announce mailing list