Array index out of range - run time



examples/array-index/array_index.go
package main

import (
    "fmt"
)

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

    fmt.Println(res)
    i := 1
    j := 4
    fmt.Println(res[i])
    fmt.Println(res[j])
}

examples/array-index/array_index.out
[7 5 9]
5
panic: runtime error: index out of range

goroutine 1 [running]:
main.main()
	/home/gabor/work/slides/golang/examples/array-index/array_index.go:14 +0x15b
exit status 2