std.range
Inclusive and exclusive ranges.
There are three range types:
Range
: a trait providing common behaviour for range types.InclusiveRange
: an inclusive range of integers.ExclusiveRang
: an exclusive range of integers.
Ranges of arbitrary types aren't supported.
Creating ranges
While you can create ranges using InclusiveRange.new
and
ExclusiveRange.new
, an easier way of doing so is using Int.to
and
Int.until
respectively. For example, to create an exclusive range from 1 to
10:
1.until(10)
For more information refer to the documentation of Int.to
and Int.until
.
Traits
Range | A range of integers. |
Classes
ExclusiveRange | An exclusive range of integers. | |
InclusiveRange | An inclusive range of integers. |