for() with 4 arguments to allow postcondition

F i L witte2008 at gmail.com
Fri Jun 22 13:38:46 PDT 2012


I don't understand why people even still use the 'for' statement 
in D. I know there's probably some situations where 'foreach' 
wont work... but honestly I don't think I've ever come across any 
yet, and foreach syntax is so much easier to understand at a 
glance. I think people still just write 'for' loops cause they're 
use to it from C/C++

The only thing that would be nice, but completely unnecessary, is 
sugar for iota() and retro():

   foreach (i; 0 .. 10, 2)
   foreach (i; 10 .. 0, -2)

becomes:

   foreach (i; iota(0, 10, 2))
   foreach (i; iota(0, 10, 2).retro())


More information about the Digitalmars-d mailing list