Next: , Previous: , Up: Arrays   [Contents][Index]

14.4.5 Array Indexing

Arrays are indexed using the usual notation, providing an index enclosed between square brackets with [ and ]:

(poke) [1,2,3][0]
(poke) [1,2,3][1]

The index should be an expression that evaluates to an integer value, and it is promoted to an unsigned 64-bit integer when needed.

The valid range for the index is [0,n] where n is the number of elements stored in the array minus one. If the passed integer is out of that range, an E_out_of_bounds exception is raised:

(poke) [1,2,3][-1]
unhandled out of bounds exception
(poke) [1,2,3][3]
unhandled out of bounds exception