Profile

Array.range

Array.range

NAME

Array::range - Get a range of integers

SYNOPSIS

[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.

DESCRIPTION

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]

AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/

LICENSE

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.

Latest Tech News
Your Notes

Sign in/Sign up

Signing in to our system allows you to post your contributions and vote on the contributions of others. It will also allow you to get extra perts like having your favorites in the cloud and having your persistent personal notes wherever you go. More will be added as we scale up our services.

By signing in to our system, you agree our Member Terms and Conditions


Sign-in with one of the following services

Almost finished!

Please select a screen name for NET SOUP.



 Please send me news and special offers from NET SOUP.

 I have read and accept the Terms of Use.

COMPLIMENTARY EXAMPLES

We have no example yet for this entry


Your Name
Now

Community Contributions and Discussions

Modify your search

View Documentation

Jobs from Indeed