Arrays

Arrays are ordered, zero-indexed collections. They are written as comma-separated values enclosed in square brackets:

[1, 2, 3]
["a", "b", "c"]
[true, 42, "mixed", null]
[]                            # Empty array

Arrays may contain any mix of types, including nested arrays and objects:

var matrix = [[1, 2], [3, 4]]
var records = [{"name": "Alice"}, {"name": "Bob"}]

Array concatenation

The + operator concatenates two arrays:

var combined = [1, 2] + [3, 4]    # [1, 2, 3, 4]

The Concatenate standard library function provides the same behaviour.

Both operands must be arrays. Using + with an array and a non-array (such as a number or string) throws a runtime error:

[1, 2] + 3             # Error: UnsupportedBinaryOperation
[1, 2] + "three"       # Error: UnsupportedBinaryOperation

To append a single element, wrap it in an array:

var result = [1, 2] + [3]    # [1, 2, 3]

Truthiness

Empty arrays [] are truthy. To check whether an array is empty, test its length explicitly:

# INCORRECT - always true, even for []
if Data.items then ... end

# CORRECT
if Length(Data.items) > 0 then ... end

See Truthiness for details.


Back to top

Copyright © Mesch Systems 2025-2026. All rights reserved.