Class std::Range
Instances of the Range class represent ascending sequences of integer values. A range is defined by two objects, the start (lower bound) and the stop (upper bound). The range includes integers from start up to, but not including, the stop.
Member constants
- start as Int
- The lower bound of the range (included in the range).
- stop as Int
- The upper bound of the range (not included in the range).
Methods
- iterator() as Iterator<Int>
- Return an iterator object that returns all integer values between the lower bound and the upper bound, in ascending order and not including the upper bound.
Operations
- x to y (Int to Int ⇒ Range)
- Construct a range object representing a range x, x + 1, ..., y - 1. Both x and y must be integers.
- for x in range (for Int in Range)
- A range can be enumerated in ascending order with a for loop, starting with the lower bound and ending with one less than the upper bound.
- range == x (Range == Object ⇒ Boolean)
- Range objects can be compared for equality. Two range objects are equal if and only if both their lower and upper bounds are equal.
- x in range (Int in Range ⇒ Boolean)
- Return a boolean indicating whether x >= start and x < stop.
- Str(range)
- Return a string representation a range.
- Hash(range)
- Return the hash value of a range.