Kaya 0.5.3 reference for Array::range

List of functions and data types in Array

[Int] range(Int first, Int last, Int step=1)

Arguments

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]
kaya@kayalang.org | Last modified 29 November 2011 | Supported by Durham CompSoc | Powered by Kaya