Function steps

Returns a range that iterates over n equally-spaced floating-point numbers in the inclusive interval [a,b].

auto auto steps(T, U) (
  T a,
  U b,
  int n
)
if (isFloatingPoint!T && isFloatingPoint!U);

This is similar to std.range.iota, except that it allows you to specify the number of steps it takes rather than the step size, and that the last point is exactly equal to b (unless n = 1, in which case a is the first and last point). This makes it more useful than iota for iterating over floating-point numbers.

Example

int i = 0;
foreach (x; steps(0.0, 9.0, 10))
{
    assert (x == i);
    ++i;
}