E5004 Runtime Errors

index-empty-collection

cannot index empty collection

When this occurs

`arr[0]` when array is empty

Example error message

error[E5004]: index out of bounds: array is empty (length 0)

How to fix

Check that the collection is not empty before indexing.

Related errors