Onetastic Macro Documentation >
>
>
Array_FromRange Array_FromRange
Creates an array containing a range of numeric values. This can be used to run a for loop on a sequence of numbers. For instance foreach ($i in Array_FromRange(1, 10, 1)) will iterate over numbers 1 to 10.
Syntax
void Array_FromRange(
Numeric start,
Numeric end,
Numeric step)
Parameters
- Numeric start
- The first value in the array.
- Numeric end
- The last value in the array.
- Numeric step
- The value to use as the increment between elements in the sequence. Can be positive for an increasing sequence or negative for a decreasing sequence. The value of end must be reachable by repeatedly incrementing start with step.
Examples
$array = Array_FromRange(1, 10, 1)
$array = Array_FromRange(10, 1, -2)
|