range : Generate an integer array with the range provided. Containing arithmetic progressions.
range(stop);
range(start,stop[, step]);
This function generate an integer array with the range provided. It is most often used in for loops. If the step argument is omitted, it defaults to 1. If the start argument is omitted, it defaults to 0. The full form returns an array of plain integers [start, start + step, start + 2 * step, ...]. If step is positive, the last element is the largest start + i * step less than stop; if step is negative, the last element is the smallest start + i * step greater than stop.
Note: all parameters have to be integers.
This function returns an new array.
range(10,0); return []
range(10,20,-2); return []
range(10); return [0,1,2,3,4,5,6,7,8,9]
range(10,20); return [10,11,12,13,14,15,16,17,18,19]
range(10,20,2); return [10,12,14,16,18]
range(-10,20,3); return [-10,-7,-4,-1,2,5,8,11,14,17]
range(0, -10, -1); return [0,-1,-2,-3,-4,-5,-6,-7,-8,-9]
range(0); return []
range(1,0); return []
Written by Pierre Laplante, <laplante@sednove.com>
Available from version 5.90
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
1.0 2014-09-09 21:24:14 laplante@sednove.com