Array index out of range - compile time



examples/array-out-of-range/array_out_of_range.go
package main

import (
    "fmt"
)

func main() {
    var res = [3]int{7, 5, 9}

    fmt.Println(res)
    fmt.Println(res[4])
    fmt.Println(len(res))

    fmt.Printf("%T\n", res)
}

examples/array-out-of-range/array_out_of_range.out
# command-line-arguments
./array_out_of_range.go:11:17: invalid array index 4 (out of bounds for 3-element array)