Class SteppedRange<EndPoint:Value?, Step:Value>
└
Value
└
Object
Similar to Range, but with a step value that indicates the number of steps to take during each
iteration. For instance, the code:
for i in SteppedRange<Int, Int>(0, 100, 10, true) {
Console.printLine(i)
}
will count by 10 and print the numbers 0, 10, 20, ..., 90, 100. The exclusive range (..) and
inclusive range (...) operators provide a shorthand syntax for creating Range and SteppedRange
objects; the loop above could be more succinctly (and readably) written:
for i in 0 ... 100 by 10 {
Console.printLine(i)
}
- Source Code:
- View Source
Initializer Summary
init (start :,EndPoint end :,EndPoint step :,Step inclusive :):Bit SteppedRange<EndPoint, Step> - Creates a new
SteppedRange.
Field Summary
start :EndPoint - The range's starting point.
end :EndPoint - The range's ending point.
step :Step - The range's step count.
inclusive :Bit -
trueif the range includes its endpoint.
Inherited Fields:
Initializers
init
(start :EndPoint ,
end :EndPoint ,
step :Step ,
inclusive :Bit
):SteppedRange<EndPoint, Step>
Fields
The range's starting point.
The range's ending point.
The range's step count.
true if the range includes its endpoint.