Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macros

Macro Debugging

How To

Using variables

Finding and modifying objects

Creating new page content

Asking for user input

Storing persistent data

Using binary data

Sorting objects

Macro menus

Bulleted and numbered lists

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: September 02, 2024
Also available as a single HTML file

Onetastic Macro Documentation > Functions > Array Functions > 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) // This is the same as $array = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) $array = Array_FromRange(10, 1, -2) // This is the same as $array = Array(10, 8, 6, 4, 2)

Reference

Statements

Hierarchy Objects

Page Objects

Other Objects

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

Special Functions

String Functions

Window Functions