Array types

ArrayType :

An array is a fixed-size sequence of N elements of type T. The array type is written as T[N]. The size is an integer literal.

Arrays are either stored in storage or memory but are never stored directly on the stack.


contract Foo:
  # An array in storage
  bar: u8[10]

  fn do_something():
    # An array in memory
    values: u256[3] = [10, 100, 100]

All elements of arrays are always initialized, and access to an array is always bounds-checked in safe methods and operators.