arrayClear

arrayClear(array array)

Removes all the elements of the list array.

Example:

var list = [1, 2, 3, 4]
arrayClear(list)
debug(list) // []
const list = [1, 2, 3, 4]
list.length = 0
Debug.log(list) // []
list = [1, 2, 3, 4]
list.clear()
Debug.log(list)  # []
Parameters
More information

In most cases, the code list = [] is equivalent to arrayClear(list). However, if you use final fields in a class, you cannot use = on them, and therefore not = [] either. In that case, arrayClear is the only easy way to empty a list.

Synonyms
Note