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