foreach

Nick Sabalausky via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 13 09:54:44 PDT 2014


On 6/13/2014 5:15 AM, Jonathan M Davis via Digitalmars-d wrote:
>
> I'd honestly rather see for(;;) {} removed than have foreach(; 0..n) {} added.
> I don't like special cases like like these.
>

Disallowing for(;;) would *be* a special case. Each of the three parts 
can be individually omitted, and that is useful. When I only need to 
omit one of the three (and there are times when I do), it's still a 
cleaner more appropriate syntax than turning it into a while. So making 
all three parts required wouldn't really work. And because of that, any 
disallowing of for(;;) would have to be a special case.



More information about the Digitalmars-d mailing list