Case Range Statement ..
Michiel Helvensteijn
m.helvensteijn.remove at gmail.com
Sat Jul 11 11:35:45 PDT 2009
Andrei Alexandrescu wrote:
> void main()
> {
> foreach_reverse (i; 0.7 .. 100.7)
> {
> write(i, " ");
> }
> }
>
> The last number printed is -0.3.
A question if I may.
Why does D allow iteration over an interval of floats? A floating point
number has no direct successor or predecessor. Any such interval would
contain zero, one or infinite elements.
Given the -0.3, I'm assuming you increase/decrease by 1.0 each iteration. Is
this useful enough to be the standard behavior?
--
Michiel Helvensteijn
More information about the Digitalmars-d
mailing list