title: InvalidIndex layout: article

InvalidIndex occurs when an index argument is not of integer type,
negative, or out-of-bounds.

Example:
 var s = [...]int{1,2,3}
 var x = s[5]

Example:
 var s = []int{1,2,3}
 var _ = s[-1]

Example:
 var s = []int{1,2,3}
 var i string
 var _ = s[i]