Enhancing foreach
Jacob Carlborg
doob at me.com
Wed Jan 9 00:01:05 PST 2013
On 2013-01-09 05:38, ixid wrote:
> A very minor change that would be elegant and easy for beginners:
>
> foreach(i;5)
> //stuff
>
> Allowing just a single number to mean the end point and a default
> starting point of zero is assumed, just as with iota it's possible to
> write it iota(5) or even 5.iota, it assumes unless otherwise specified
> that you mean 0 to be the starting point. Would this be a reasonable
> enhancement request for me to make or does it collide with something?
I don't see what this would gain over:
foreach (i ; 0 .. 5)
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list