An Array is a storage for values. You can access it using indexes or with its API.

See:

Constructor

new()

Creates a new Array.

Variables

read onlylength:Int

The length of this Array.

Methods

concat(a:Array<T>):Array<T>

Returns a new Array by appending the elements of a to the elements of this Array.

This operation does not modify this Array.

If a is the empty Array [], a copy of this Array is returned.

The length of the returned Array is equal to the sum of this.length and a.length.

If a is null, the result is unspecified.

indexOf(x:T, ?fromIndex:Int):Int

Returns position of the first occurrence of x in this Array, searching front to back.

If x is found by checking standard equality, the function returns its index.

If x is not found, the function returns -1.

If fromIndex is specified, it will be used as the starting index to search from, otherwise search starts with zero index. If it is negative, it will be taken as the offset from the end of this Array to compute the starting index. If given or computed starting index is less than 0, the whole array will be searched, if it is greater than or equal to the length of this Array, the function returns -1.

join(sep:String):String

Returns a string representation of this Array, with sep separating each element.

The result of this operation is equal to Std.string(this[0]) + sep + Std.string(this[1]) + sep + ... + sep + Std.string(this[this.length-1])

If this is the empty Array [], the result is the empty String "". If this has exactly one element, the result is equal to a call to Std.string(this[0]).

If sep is null, the result is unspecified.

push(x:T):Int

Adds the element x at the end of this Array and returns the new length of this Array.

This operation modifies this Array in place.

this.length increases by 1.

shift():Null<T>

Removes the first element of this Array and returns it.

This operation modifies this Array in place.

If this has at least one element, this.length and the index of each remaining element is decreased by 1.

If this is the empty Array [], null is returned and the length remains 0.