An example of declaration and assignment.
a := [5]int{5, 4, 3, 2, 1}
Modify values by index.
a[2] = 99
The following is a complete code example.
package main
import "fmt"
func main() {
var s [2]string
fmt.Println(s)
i := [5]int{5, 4, 3, 2, 1}
a[2] = 99
fmt.Println(i)
}
Below is the program output:
[ ]
[5 4 3 2 1]