types.Array.clear
Method on every
arrayclear(): any
Removes every element from the array.
Return value
This array, now empty.
Notes
Equivalent to resize(0), including that the backing storage is released once the array shrinks past its shrink threshold, not merely marked empty.
Example
let a = [1, 2, 3];
let same = a.clear();
println("same == a:", same == a); // clear() returns this array, now empty
println("a.len() =", a.len());Output:
same == a: true
a.len() = 0See also
resize | Grows or shrinks the array to size elements. |
clone | Makes a shallow copy of the array. |
| array | class index |