Array and Set Literals

Array and Set literals are surrounded by square brackets ([]) and contain zero or more expressions, separated by comma (,) that provide the individual elements of an Array or Set.

The type of all expressions must match, and the type of the underlying array or set will be inferred, if necessary to the closest common base type. Whether the literal becomes an array or a set will also be inferred based on context, where an Array is inferred by default, if there is ambiguity.

method TakeArray(x: array of Integer);

...

TakeArray([1, 2, 3, 4, 5]);
var y := [0, 1, 2, 3, 4.5]; // array of double
var z: set of Integer := [1, 2, 3];

See Also