The Array data type

The data type of arrays is Array. By default, Array matches arrays of any length, provided all values in the array match the abstract data type Data. You can use parameters to restrict which values Array matches.

Parameters

The full signature for Array is:

Copy
Array[<CONTENT TYPE>, <MIN SIZE>, <MAX SIZE>]

These parameters are optional. They must be listed in order; if you need to specify a later parameter, you must also specify values for any prior ones.

Position Parameter Data type Default value Description
1 Content type Type Data The kind of values the array contains. You can specify only one data type per array, and every value in the array must match that type. Use an abstract type to allow multiple data types. If the order of elements matters, use the Tuple type instead of Array.
2 Minimum size Integer 0 The minimum number of elements in the array. This parameter accepts the special value default, which uses its default value.
3 Maximum size Integer infinite The maximum number of elements in the array. This parameter accepts the special value default, which uses its default value.

Examples:

  • Array

    Matches an array of any length. All elements in the array must match Data.

  • Array[String]

    Matches an array of any size that contains only strings.

  • Array[Integer, 6]

    Matches an array containing at least six integers.

  • Array[Float, 6, 12]

    Matches an array containing at least six and at most 12 floating-point numbers.

  • Array[Variant[String, Integer]]

    Matches an array of any size that contains only strings or integers, or both.

  • Array[Any, 2]

    Matches an array containing at least two elements, allowing any data type (including Type and Resource).

The abstract Tuple data type lets you specify data types for every element in an array, in order. Abstract types, such as Variant and Enum, are useful when specifying content types for arrays that include multiple kinds of data.