On Monday, 17 February 2014 at 19:22:38 UTC, simendsjo wrote:
Should the following two uses be a compile-time error?
  foreach(i; 10 .. 0) // Never executes

  foreach(i; iota(10, 0)) // .. neither does this

I would like the second to either be a compile-time error or automagically use a negative step.

So we need to use a negative step in iota() or use a for loop
  foreach(i; iota(10, 0, -1)) // as expected

Ruby and Groovy has this feature. I'd support this.

Reply via email to