klyn.collections.Array.Array
constructor
public native Array(size as Long)
Description

Creates a new array with a fixed number of elements.

Primitive numeric and boolean slots are initialized to zero / false. Other ValueType slots each receive a distinct value constructed by T(). The constructor must be accessible without required arguments. Nullable reference slots are initialized to null.

import klyn.collections

values as Int[] = Int[4]
print(values)     # f:[0, 0, 0, 0]
Parameters
ParameterDescription
sizeNumber of elements to allocate.
Throws
  • TypeError if a ValueType has no accessible default constructor.
  • ValueException if size is negative.
  • OutOfMemoryError if the storage exceeds the addressable range or cannot be allocated.