Hey I am trying to create a simple scalar vector for my program.
I was starting with a simple variable and incrementing it to make it a 32 by 1 size vector matrix.
var x []int
for i := 0; i < 32 ; i++{
x[i] = i + 1
}
Simple enough but when trying to compile this I get this error.
panic: runtime error: index out of range
goroutine 1 [running]:
main.main()
/Users/jeanmac/go/src/matrices/main.go:69 +0x7d
Process finished with exit code 2
Not sure why. FYI Line 69 refers to x[i] = i + 1
.
When trying to assign x[i]
I receive the following warning.
Reports indexing of nil map or slice that may lead to runtime panic.
Not sure why this seems to be happening.