blob: 6915aa06e0f78e569cdea0672e595a3ab631ab86 [file] [view]
---
title: InvalidIndex
layout: article
---
<!-- Copyright 2023 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. -->
<!-- Code generated by generrordocs.go; DO NOT EDIT. -->
```
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]
```