Array

A built-in data structure that holds a sequence of elements.

Description

An array data structure that can contain a sequence of elements of anyVariant type. Elements are accessed by a numerical index starting at0. Negative indices are used to count from the back (-1 is the last element,-2 is the second to last, etc.).

vararray=["First",2,3,"Last"]print(array[0])# Prints "First"print(array[2])# Prints 3print(array[-1])# Prints "Last"array[1]="Second"print(array[1])# Prints "Second"print(array[-3])# Prints "Second"

Note: Arrays are always passed byreference. To get a copy of an array that can be modified independently of the original array, useduplicate().

Note: Erasing elements while iterating over arrays isnot supported and will result in unpredictable behavior.

Differences between packed arrays, typed arrays, and untyped arrays: Packed arrays are generally faster to iterate on and modify compared to a typed array of the same type (e.g.PackedInt64Array versusArray[int]). Also, packed arrays consume less memory. As a downside, packed arrays are less flexible as they don't offer as many convenience methods such asmap(). Typed arrays are in turn faster to iterate on and modify than untyped arrays.

Note

There are notable differences when using this API with C#. SeeC# API differences to GDScript for more information.

Constructors

Array

Array()

Array

Array(base:Array, type:int, class_name:StringName, script:Variant)

Array

Array(from:Array)

Array

Array(from:PackedByteArray)

Array

Array(from:PackedColorArray)

Array

Array(from:PackedFloat32Array)

Array

Array(from:PackedFloat64Array)

Array

Array(from:PackedInt32Array)

Array

Array(from:PackedInt64Array)

Array

Array(from:PackedStringArray)

Array

Array(from:PackedVector2Array)

Array

Array(from:PackedVector3Array)

Array

Array(from:PackedVector4Array)

Methods

bool

all(method:Callable)const

bool

any(method:Callable)const

void

append(value:Variant)

void

append_array(array:Array)

void

assign(array:Array)

Variant

back()const

int

bsearch(value:Variant, before:bool = true)const

int

bsearch_custom(value:Variant, func:Callable, before:bool = true)const

void

clear()

int

count(value:Variant)const

Array

duplicate(deep:bool = false)const

void

erase(value:Variant)

void

fill(value:Variant)

Array

filter(method:Callable)const

int

find(what:Variant, from:int = 0)const

int

find_custom(method:Callable, from:int = 0)const

Variant

front()const

Variant

get(index:int)const

int

get_typed_builtin()const

StringName

get_typed_class_name()const

Variant

get_typed_script()const

bool

has(value:Variant)const

int

hash()const

int

insert(position:int, value:Variant)

bool

is_empty()const

bool

is_read_only()const

bool

is_same_typed(array:Array)const

bool

is_typed()const

void

make_read_only()

Array

map(method:Callable)const

Variant

max()const

Variant

min()const

Variant

pick_random()const

Variant

pop_at(position:int)

Variant

pop_back()

Variant

pop_front()

void

push_back(value:Variant)

void

push_front(value:Variant)

Variant

reduce(method:Callable, accum:Variant = null)const

void

remove_at(position:int)

int

resize(size:int)

void

reverse()

int

rfind(what:Variant, from:int = -1)const

int

rfind_custom(method:Callable, from:int = -1)const

void

set(index:int, value:Variant)

void

shuffle()

int

size()const

Array

slice(begin:int, end:int = 2147483647, step:int = 1, deep:bool = false)const

void

sort()

void

sort_custom(func:Callable)

Operators

bool

operator !=(right:Array)

Array

operator +(right:Array)

bool

operator <(right:Array)

bool

operator <=(right:Array)

bool

operator ==(right:Array)

bool

operator >(right:Array)

bool

operator >=(right:Array)

Variant

operator [](index:int)


Constructor Descriptions

ArrayArray()🔗

Constructs an emptyArray.


ArrayArray(base:Array, type:int, class_name:StringName, script:Variant)

Creates a typed array from thebase array. A typed array can only contain elements of the given type, or that inherit from the given class, as described by this constructor's parameters:

Iftype is not@GlobalScope.TYPE_OBJECT,class_name must be an emptyStringName andscript must benull.

class_nameSwordextendsNodeclassStats:passfunc_ready():vara=Array([],TYPE_INT,"",null)# Array[int]varb=Array([],TYPE_OBJECT,"Node",null)# Array[Node]varc=Array([],TYPE_OBJECT,"Node",Sword)# Array[Sword]vard=Array([],TYPE_OBJECT,"RefCounted",Stats)# Array[Stats]

Thebase array's elements are converted when necessary. If this is not possible orbase is already typed, this constructor fails and returns an emptyArray.

In GDScript, this constructor is usually not necessary, as it is possible to create a typed array through static typing:

varnumbers:Array[float]=[]varchildren:Array[Node]=[$Node,$Sprite2D,$RigidBody3D]varintegers:Array[int]=[0.2,4.5,-2.0]print(integers)# Prints [0, 4, -2]

ArrayArray(from:Array)

Returns the same array asfrom. If you need a copy of the array, useduplicate().


ArrayArray(from:PackedByteArray)

Constructs an array from aPackedByteArray.


ArrayArray(from:PackedColorArray)

Constructs an array from aPackedColorArray.


ArrayArray(from:PackedFloat32Array)

Constructs an array from aPackedFloat32Array.


ArrayArray(from:PackedFloat64Array)

Constructs an array from aPackedFloat64Array.


ArrayArray(from:PackedInt32Array)

Constructs an array from aPackedInt32Array.


ArrayArray(from:PackedInt64Array)

Constructs an array from aPackedInt64Array.


ArrayArray(from:PackedStringArray)

Constructs an array from aPackedStringArray.


ArrayArray(from:PackedVector2Array)

Constructs an array from aPackedVector2Array.


ArrayArray(from:PackedVector3Array)

Constructs an array from aPackedVector3Array.


ArrayArray(from:PackedVector4Array)

Constructs an array from aPackedVector4Array.


Method Descriptions

boolall(method:Callable)const🔗

Calls the givenCallable on each element in the array and returnstrue if theCallable returnstrue forall elements in the array. If theCallable returnsfalse for one array element or more, this method returnsfalse.

Themethod should take oneVariant parameter (the current array element) and return abool.

funcgreater_than_5(number):returnnumber>5func_ready():print([6,10,6].all(greater_than_5))# Prints true (3/3 elements evaluate to true).print([4,10,4].all(greater_than_5))# Prints false (1/3 elements evaluate to true).print([4,4,4].all(greater_than_5))# Prints false (0/3 elements evaluate to true).print([].all(greater_than_5))# Prints true (0/0 elements evaluate to true).# Same as the first line above, but using a lambda function.print([6,10,6].all(func(element):returnelement>5))# Prints true

See alsoany(),filter(),map() andreduce().

Note: Unlike relying on the size of an array returned byfilter(), this method will return as early as possible to improve performance (especially with large arrays).

Note: For an empty array, this methodalways returnstrue.


boolany(method:Callable)const🔗

Calls the givenCallable on each element in the array and returnstrue if theCallable returnstrue forone or more elements in the array. If theCallable returnsfalse for all elements in the array, this method returnsfalse.

Themethod should take oneVariant parameter (the current array element) and return abool.

funcgreater_than_5(number):returnnumber>5func_ready():print([6,10,6].any(greater_than_5))# Prints true (3 elements evaluate to true).print([4,10,4].any(greater_than_5))# Prints true (1 elements evaluate to true).print([4,4,4].any(greater_than_5))# Prints false (0 elements evaluate to true).print([].any(greater_than_5))# Prints false (0 elements evaluate to true).# Same as the first line above, but using a lambda function.print([6,10,6].any(func(number):returnnumber>5))# Prints true

See alsoall(),filter(),map() andreduce().

Note: Unlike relying on the size of an array returned byfilter(), this method will return as early as possible to improve performance (especially with large arrays).

Note: For an empty array, this method always returnsfalse.


voidappend(value:Variant)🔗

Appendsvalue at the end of the array (alias ofpush_back()).


voidappend_array(array:Array)🔗

Appends anotherarray at the end of this array.

varnumbers=[1,2,3]varextra=[4,5,6]numbers.append_array(extra)print(numbers)# Prints [1, 2, 3, 4, 5, 6]

voidassign(array:Array)🔗

Assigns elements of anotherarray into the array. Resizes the array to matcharray. Performs type conversions if the array is typed.


Variantback()const🔗

Returns the last element of the array. If the array is empty, fails and returnsnull. See alsofront().

Note: Unlike with the[] operator (array[-1]), an error is generated without stopping project execution.


intbsearch(value:Variant, before:bool = true)const🔗

Returns the index ofvalue in the sorted array. If it cannot be found, returns wherevalue should be inserted to keep the array sorted. The algorithm used isbinary search.

Ifbefore istrue (as by default), the returned index comes before all existing elements equal tovalue in the array.

varnumbers=[2,4,8,10]varidx=numbers.bsearch(7)numbers.insert(idx,7)print(numbers)# Prints [2, 4, 7, 8, 10]varfruits=["Apple","Lemon","Lemon","Orange"]print(fruits.bsearch("Lemon",true))# Prints 1, points at the first "Lemon".print(fruits.bsearch("Lemon",false))# Prints 3, points at "Orange".

Note: Callingbsearch() on anunsorted array will result in unexpected behavior. Usesort() before calling this method.


intbsearch_custom(value:Variant, func:Callable, before:bool = true)const🔗

Returns the index ofvalue in the sorted array. If it cannot be found, returns wherevalue should be inserted to keep the array sorted (usingfunc for the comparisons). The algorithm used isbinary search.

Similar tosort_custom(),func is called as many times as necessary, receiving one array element andvalue as arguments. The function should returntrue if the array element should bebehindvalue, otherwise it should returnfalse.

Ifbefore istrue (as by default), the returned index comes before all existing elements equal tovalue in the array.

funcsort_by_amount(a,b):ifa[1]<b[1]:returntruereturnfalsefunc_ready():varmy_items=[["Tomato",2],["Kiwi",5],["Rice",9]]varapple=["Apple",5]# "Apple" is inserted before "Kiwi".my_items.insert(my_items.bsearch_custom(apple,sort_by_amount,true),apple)varbanana=["Banana",5]# "Banana" is inserted after "Kiwi".my_items.insert(my_items.bsearch_custom(banana,sort_by_amount,false),banana)# Prints [["Tomato", 2], ["Apple", 5], ["Kiwi", 5], ["Banana", 5], ["Rice", 9]]print(my_items)

Note: Callingbsearch_custom() on anunsorted array will result in unexpected behavior. Usesort_custom() withfunc before calling this method.


voidclear()🔗

Removes all elements from the array. This is equivalent to usingresize() with a size of0.


intcount(value:Variant)const🔗

Returns the number of times an element is in the array.

To count how many elements in an array satisfy a condition, seereduce().


Arrayduplicate(deep:bool = false)const🔗

Returns a new copy of the array.

By default, ashallow copy is returned: all nestedArray andDictionary elements are shared with the original array. Modifying them in one array will also affect them in the other.

Ifdeep istrue, adeep copy is returned: all nested arrays and dictionaries are also duplicated (recursively).


voiderase(value:Variant)🔗

Finds and removes the first occurrence ofvalue from the array. Ifvalue does not exist in the array, nothing happens. To remove an element by index, useremove_at() instead.

Note: This method shifts every element's index after the removedvalue back, which may have a noticeable performance cost, especially on larger arrays.

Note: Erasing elements while iterating over arrays isnot supported and will result in unpredictable behavior.


voidfill(value:Variant)🔗

Assigns the givenvalue to all elements in the array.

This method can often be combined withresize() to create an array with a given size and initialized elements:

vararray=[]array.resize(5)array.fill(2)print(array)# Prints [2, 2, 2, 2, 2]

Note: Ifvalue is aVariant passed by reference (Object-derived,Array,Dictionary, etc.), the array will be filled with references to the samevalue, which are not duplicates.


Arrayfilter(method:Callable)const🔗

Calls the givenCallable on each element in the array and returns a new, filteredArray.

Themethod receives one of the array elements as an argument, and should returntrue to add the element to the filtered array, orfalse to exclude it.

funcis_even(number):returnnumber%2==0func_ready():print([1,4,5,8].filter(is_even))# Prints [4, 8]# Same as above, but using a lambda function.print([1,4,5,8].filter(func(number):returnnumber%2==0))

See alsoany(),all(),map() andreduce().


intfind(what:Variant, from:int = 0)const🔗

Returns the index of thefirst occurrence ofwhat in this array, or-1 if there are none. The search's start can be specified withfrom, continuing to the end of the array.

Note: If you just want to know whether the array containswhat, usehas() (Contains in C#). In GDScript, you may also use thein operator.

Note: For performance reasons, the search is affected bywhat'sVariant.Type. For example,7 (int) and7.0 (float) are not considered equal for this method.


intfind_custom(method:Callable, from:int = 0)const🔗

Returns the index of thefirst element in the array that causesmethod to returntrue, or-1 if there are none. The search's start can be specified withfrom, continuing to the end of the array.

method is a callable that takes an element of the array, and returns abool.

Note: If you just want to know whether the array containsanything that satisfiesmethod, useany().

funcis_even(number):returnnumber%2==0func_ready():print([1,3,4,7].find_custom(is_even.bind()))# Prints 2

Variantfront()const🔗

Returns the first element of the array. If the array is empty, fails and returnsnull. See alsoback().

Note: Unlike with the[] operator (array[0]), an error is generated without stopping project execution.


Variantget(index:int)const🔗

Returns the element at the givenindex in the array. This is the same as using the[] operator (array[index]).


intget_typed_builtin()const🔗

Returns the built-inVariant type of the typed array as aVariant.Type constant. If the array is not typed, returns@GlobalScope.TYPE_NIL. See alsois_typed().


StringNameget_typed_class_name()const🔗

Returns thebuilt-in class name of the typed array, if the built-inVariant type@GlobalScope.TYPE_OBJECT. Otherwise, returns an emptyStringName. See alsois_typed() andObject.get_class().


Variantget_typed_script()const🔗

Returns theScript instance associated with this typed array, ornull if it does not exist. See alsois_typed().


boolhas(value:Variant)const🔗

Returnstrue if the array contains the givenvalue.

print(["inside",7].has("inside"))# Prints trueprint(["inside",7].has("outside"))# Prints falseprint(["inside",7].has(7))# Prints trueprint(["inside",7].has("7"))# Prints false

In GDScript, this is equivalent to thein operator:

if4in[2,4,6,8]:print("4 is here!")# Will be printed.

Note: For performance reasons, the search is affected by thevalue'sVariant.Type. For example,7 (int) and7.0 (float) are not considered equal for this method.


inthash()const🔗

Returns a hashed 32-bit integer value representing the array and its contents.

Note: Arrays with equal hash values arenot guaranteed to be the same, as a result of hash collisions. On the countrary, arrays with different hash values are guaranteed to be different.


intinsert(position:int, value:Variant)🔗

Inserts a new element (value) at a given index (position) in the array.position should be between0 and the array'ssize().

Returns@GlobalScope.OK on success, or one of the otherError constants if this method fails.

Note: Every element's index afterposition needs to be shifted forward, which may have a noticeable performance cost, especially on larger arrays.


boolis_empty()const🔗

Returnstrue if the array is empty ([]). See alsosize().


boolis_read_only()const🔗

Returnstrue if the array is read-only. Seemake_read_only().

In GDScript, arrays are automatically read-only if declared with theconst keyword.


boolis_same_typed(array:Array)const🔗

Returnstrue if this array is typed the same as the givenarray. See alsois_typed().


boolis_typed()const🔗

Returnstrue if the array is typed. Typed arrays can only contain elements of a specific type, as defined by the typed array constructor. The methods of a typed array are still expected to return a genericVariant.

In GDScript, it is possible to define a typed array with static typing:

varnumbers:Array[float]=[0.2,4.2,-2.0]print(numbers.is_typed())# Prints true

voidmake_read_only()🔗

Makes the array read-only. The array's elements cannot be overridden with different values, and their order cannot change. Does not apply to nested elements, such as dictionaries.

In GDScript, arrays are automatically read-only if declared with theconst keyword.


Arraymap(method:Callable)const🔗

Calls the givenCallable for each element in the array and returns a new array filled with values returned by themethod.

Themethod should take oneVariant parameter (the current array element) and can return anyVariant.

funcdouble(number):returnnumber*2func_ready():print([1,2,3].map(double))# Prints [2, 4, 6]# Same as above, but using a lambda function.print([1,2,3].map(func(element):returnelement*2))

See alsofilter(),reduce(),any() andall().


Variantmax()const🔗

Returns the maximum value contained in the array, if all elements can be compared. Otherwise, returnsnull. See alsomin().

To find the maximum value using a custom comparator, you can usereduce().


Variantmin()const🔗

Returns the minimum value contained in the array, if all elements can be compared. Otherwise, returnsnull. See alsomax().


Variantpick_random()const🔗

Returns a random element from the array. Generates an error and returnsnull if the array is empty.

# May print 1, 2, 3.25, or "Hi".print([1,2,3.25,"Hi"].pick_random())

Note: Like many similar functions in the engine (such as@GlobalScope.randi() orshuffle()), this method uses a common, global random seed. To get a predictable outcome from this method, see@GlobalScope.seed().


Variantpop_at(position:int)🔗

Removes and returns the element of the array at indexposition. If negative,position is considered relative to the end of the array. Returnsnull if the array is empty. Ifposition is out of bounds, an error message is also generated.

Note: This method shifts every element's index afterposition back, which may have a noticeable performance cost, especially on larger arrays.


Variantpop_back()🔗

Removes and returns the last element of the array. Returnsnull if the array is empty, without generating an error. See alsopop_front().


Variantpop_front()🔗

Removes and returns the first element of the array. Returnsnull if the array is empty, without generating an error. See alsopop_back().

Note: This method shifts every other element's index back, which may have a noticeable performance cost, especially on larger arrays.


voidpush_back(value:Variant)🔗

Appends an element at the end of the array. See alsopush_front().


voidpush_front(value:Variant)🔗

Adds an element at the beginning of the array. See alsopush_back().

Note: This method shifts every other element's index forward, which may have a noticeable performance cost, especially on larger arrays.


Variantreduce(method:Callable, accum:Variant = null)const🔗

Calls the givenCallable for each element in array, accumulates the result inaccum, then returns it.

Themethod takes two arguments: the current value ofaccum and the current array element. Ifaccum isnull (as by default), the iteration will start from the second element, with the first one used as initial value ofaccum.

funcsum(accum,number):returnaccum+numberfunc_ready():print([1,2,3].reduce(sum,0))# Prints 6print([1,2,3].reduce(sum,10))# Prints 16# Same as above, but using a lambda function.print([1,2,3].reduce(func(accum,number):returnaccum+number,10))

Ifmax() is not desirable, this method may also be used to implement a custom comparator:

func_ready():vararr=[Vector2i(5,0),Vector2i(3,4),Vector2i(1,2)]varlongest_vec=arr.reduce(func(max,vec):returnvecifis_length_greater(vec,max)elsemax)print(longest_vec)# Prints (3, 4)funcis_length_greater(a,b):returna.length()>b.length()

This method can also be used to count how many elements in an array satisfy a certain condition, similar tocount():

funcis_even(number):returnnumber%2==0func_ready():vararr=[1,2,3,4,5]# If the current element is even, increment count, otherwise leave count the same.vareven_count=arr.reduce(func(count,next):returncount+1ifis_even(next)elsecount,0)print(even_count)# Prints 2

See alsomap(),filter(),any(), andall().


voidremove_at(position:int)🔗

Removes the element from the array at the given index (position). If the index is out of bounds, this method fails.

If you need to return the removed element, usepop_at(). To remove an element by value, useerase() instead.

Note: This method shifts every element's index afterposition back, which may have a noticeable performance cost, especially on larger arrays.

Note: Theposition cannot be negative. To remove an element relative to the end of the array, usearr.remove_at(arr.size()-(i+1)). To remove the last element from the array, usearr.resize(arr.size()-1).


intresize(size:int)🔗

Sets the array's number of elements tosize. Ifsize is smaller than the array's current size, the elements at the end are removed. Ifsize is greater, new default elements (usuallynull) are added, depending on the array's type.

Returns@GlobalScope.OK on success, or one of the otherError constants if this method fails.

Note: Calling this method once and assigning the new values is faster than callingappend() for every new element.


voidreverse()🔗

Reverses the order of all elements in the array.


intrfind(what:Variant, from:int = -1)const🔗

Returns the index of thelast occurrence ofwhat in this array, or-1 if there are none. The search's start can be specified withfrom, continuing to the beginning of the array. This method is the reverse offind().


intrfind_custom(method:Callable, from:int = -1)const🔗

Returns the index of thelast element of the array that causesmethod to returntrue, or-1 if there are none. The search's start can be specified withfrom, continuing to the beginning of the array. This method is the reverse offind_custom().


voidset(index:int, value:Variant)🔗

Sets the value of the element at the givenindex to the givenvalue. This will not change the size of the array, it only changes the value at an index already in the array. This is the same as using the[] operator (array[index]=value).


voidshuffle()🔗

Shuffles all elements of the array in a random order.

Note: Like many similar functions in the engine (such as@GlobalScope.randi() orpick_random()), this method uses a common, global random seed. To get a predictable outcome from this method, see@GlobalScope.seed().


intsize()const🔗

Returns the number of elements in the array. Empty arrays ([]) always return0. See alsois_empty().


Arrayslice(begin:int, end:int = 2147483647, step:int = 1, deep:bool = false)const🔗

Returns a newArray containing this array's elements, from indexbegin (inclusive) toend (exclusive), everystep elements.

If eitherbegin orend are negative, their value is relative to the end of the array.

Ifstep is negative, this method iterates through the array in reverse, returning a slice ordered backwards. For this to work,begin must be greater thanend.

Ifdeep istrue, all nestedArray andDictionary elements in the slice are duplicated from the original, recursively. See alsoduplicate()).

varletters=["A","B","C","D","E","F"]print(letters.slice(0,2))# Prints ["A", "B"]print(letters.slice(2,-2))# Prints ["C", "D"]print(letters.slice(-2,6))# Prints ["E", "F"]print(letters.slice(0,6,2))# Prints ["A", "C", "E"]print(letters.slice(4,1,-1))# Prints ["E", "D", "C"]

voidsort()🔗

Sorts the array in ascending order. The final order is dependent on the "less than" (<) comparison between elements.

varnumbers=[10,5,2.5,8]numbers.sort()print(numbers)# Prints [2.5, 5, 8, 10]

Note: The sorting algorithm used is notstable. This means that equivalent elements (such as2 and2.0) may have their order changed when callingsort().


voidsort_custom(func:Callable)🔗

Sorts the array using a customCallable.

func is called as many times as necessary, receiving two array elements as arguments. The function should returntrue if the first element should be movedbefore the second one, otherwise it should returnfalse.

funcsort_ascending(a,b):ifa[1]<b[1]:returntruereturnfalsefunc_ready():varmy_items=[["Tomato",5],["Apple",9],["Rice",4]]my_items.sort_custom(sort_ascending)print(my_items)# Prints [["Rice", 4], ["Tomato", 5], ["Apple", 9]]# Sort descending, using a lambda function.my_items.sort_custom(func(a,b):returna[1]>b[1])print(my_items)# Prints [["Apple", 9], ["Tomato", 5], ["Rice", 4]]

It may also be necessary to use this method to sort strings by natural order, withString.naturalnocasecmp_to(), as in the following example:

varfiles=["newfile1","newfile2","newfile10","newfile11"]files.sort_custom(func(a,b):returna.naturalnocasecmp_to(b)<0)print(files)# Prints ["newfile1", "newfile2", "newfile10", "newfile11"]

Note: In C#, this method is not supported.

Note: The sorting algorithm used is notstable. This means that values considered equal may have their order changed when calling this method.

Note: You should not randomize the return value offunc, as the heapsort algorithm expects a consistent result. Randomizing the return value will result in unexpected behavior.


Operator Descriptions

booloperator !=(right:Array)🔗

Returnstrue if the array's size or its elements are different thanright's.


Arrayoperator +(right:Array)🔗

Appends theright array to the left operand, creating a newArray. This is also known as an array concatenation.

vararray1=["One",2]vararray2=[3,"Four"]print(array1+array2)# Prints ["One", 2, 3, "Four"]

Note: For existing arrays,append_array() is much more efficient than concatenation and assignment with the+= operator.


booloperator <(right:Array)🔗

Compares the elements of both arrays in order, starting from index0 and ending on the last index in common between both arrays. For each pair of elements, returnstrue if this array's element is less thanright's,false if this element is greater. Otherwise, continues to the next pair.

If all searched elements are equal, returnstrue if this array's size is less thanright's, otherwise returnsfalse.


booloperator <=(right:Array)🔗

Compares the elements of both arrays in order, starting from index0 and ending on the last index in common between both arrays. For each pair of elements, returnstrue if this array's element is less thanright's,false if this element is greater. Otherwise, continues to the next pair.

If all searched elements are equal, returnstrue if this array's size is less or equal toright's, otherwise returnsfalse.


booloperator ==(right:Array)🔗

Compares the left operandArray against therightArray. Returnstrue if the sizes and contents of the arrays are equal,false otherwise.


booloperator >(right:Array)🔗

Compares the elements of both arrays in order, starting from index0 and ending on the last index in common between both arrays. For each pair of elements, returnstrue if this array's element is greater thanright's,false if this element is less. Otherwise, continues to the next pair.

If all searched elements are equal, returnstrue if this array's size is greater thanright's, otherwise returnsfalse.


booloperator >=(right:Array)🔗

Compares the elements of both arrays in order, starting from index0 and ending on the last index in common between both arrays. For each pair of elements, returnstrue if this array's element is greater thanright's,false if this element is less. Otherwise, continues to the next pair.

If all searched elements are equal, returnstrue if this array's size is greater or equal toright's, otherwise returnsfalse.


Variantoperator [](index:int)🔗

Returns theVariant element at the specifiedindex. Arrays start at index 0. Ifindex is greater or equal to0, the element is fetched starting from the beginning of the array. Ifindex is a negative value, the element is fetched starting from the end. Accessing an array out-of-bounds will cause a run-time error, pausing the project execution if run from the editor.


User-contributed notes

Please read theUser-contributed notes policy before submitting a comment.