Array.range3kaya
Get a range of integers
Usage
[Int] range( Int first, Int last, Int step=1 )
Arguments
first The first value in the returned array
last The limit of the last value in the returned array
step The difference between adjacent values (cannot be zero!). This argument is optional and defaults to 1.
Overview
Return an array of values from [ first
last ], incrementing by step
-
xs = range(1,5); // [1,2,3,4,5]
xs = range(1,5,2); // [1,3,5]
xs = range(1,5,3); // [1,4]
xs = range(8,4,-1); // [8,7,6,5,4]
The usual way of calling the range function is using the [first..last] or [first,second..last] syntax.
-
xs = [1..5]; // [1,2,3,4,5]
xs = [1,3..5]; // [1,3,5]
xs = [1,4..5]; // [1,4]
xs = [8,7..4]; // [8,7,6,5,4]
Releases
4 releases since Debian 5.0 (Lenny); the text changed 3 times.