Import std.core.range
std.core.range
Ranges of integers, as For loops count them.
Range<T>: the integers a range gives, like 0 Until 10, 1 To 10, or 10 To 0 Step -2, which are
the values a For loop with those bounds counts. The compiler makes each one from what's written,
so a Range holds only the value it gives next, its step, and how many steps come after that
value. An empty range is a Range's zero. Ranges are == when they give the same values.
std/core/range.fb
Types
Range
struct
Public Struct Range<T: Numeric> Implements Iterator<T>, Iterable<T>
The integers from a start to an end, by a step, as a range like 0 Until 10 gives them.
Examples
Local evens: Int[] = []
For i In 0 Until 10 Step 2
evens.Add(i)
End For
Expect(evens == [0, 2, 4, 6, 8])
Expect((10 To 0 Step -5).ToArray() == [10, 5, 0])-
The next value, or Null after the last one.
-
A copy of the range, which goes over its values from where it is.
Extends
Range
extend
Extend Range<T>
Compares Ranges with == and !=, by the values they give.
-
Whether
aandbgive the same values: every range that gives none does, whatever it gave before, and the step counts only where there's a value after Current.
Report an issue with this page or with FutureBlitz on GitHub.