[Int] range(Int first, Int last, Int step=1)
Arguments
first: The first value in the returned arraylast: The limit of the last value in the returned arraystep: The difference between adjacent values (cannot be zero!). This argument is optional and defaults to 1.
Usage
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]