no, yours will print 1 0 0 mine will print 0 1 2 3 4 5 6 7 8 9 10 11 ... 100
On Wed, Oct 12, 2011 at 12:46 PM, bearophile <[email protected]> wrote: > Gor Gyolchanyan: > >> 4. Allow foreach loops with a single iterator to be specified without >> a body, in which case it would return an input range (or some other >> type of range), lazily evaluating and returning the iterator. >> void printRange(Range)(Range range) { foreach(r, range) { writeln(r); } >> }; >> unittest { printRange(foreach(i; 0..100)); } > > Is this the same? > > unittest { printRange(std.range.iota(100)); } > > Bye, > bearophile >
