until method

Iterable<int> until(
  1. int n
)

Creates an Iterable<int> that contains all values from current integer until (excluding) the value n.

Example:

0.until(5); // [0, 1, 2, 3, 4]
3.until(1); // [3, 2]

Implementation

Iterable<int> until(int n) {
  if (this < n) {
    return rangeTo(n - 1);
  } else if (this > n) {
    return rangeTo(n + 1);
  } else {
    return Iterable.empty();
  }
}