Since array access in Haxe is unbounded, i.e. it is guaranteed to not throw an exception, this requires further discussion:

If a read access is made on a non-existing index, a target-dependent value is returned.

If a write access is made with a positive index which is out of bounds, null (or the default value for basic types on static targets) is inserted at all positions between the last defined index and the newly written one.

If a write access is made with a negative index, the result is unspecified.

Arrays define an iterator over their elements. This iteration is typically optimized by the compiler to use a while loop with array index: