Andrei Alexandrescu wrote: > bearophile wrote: >> As an alternative syntax may be: >> >> foreach (i; 1:10) {...} >> foreach (i; 10 : 1 : -1) {...} >> foreach (i; 0.0 : 10.5 : 0.5) {...} > > I have an idea - we define a contextual keyword "iota" that helps us > specify from, to, and stride. Then we can write: > > foreach (i; iota(0.0, 10.5, 0.5)) {...} > > > Andrei
How about the more intuitive "foreach (i; 0 .. 10.5 stride 0.5)"? It doesn't always have to be a symbol. ^^