Get a range of integers
[Int] range( Int first, Int last, Int step=1 )
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.
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]
Kaya standard library by Edwin Brady, Chris Morris and others ([email protected]). For further information see http://kayalang.org/
The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.