7. Arrays and Slices — A Book of Go
2 min readMay 15, 2024
Arrays and slices are ways to create “lists” of data in Go. The key difference between both is that arrays are of fixed size, while slices can grow and shrink in size.
Arrays
The type [n]T
is an array of n
values of type T
.
var a [10]int
Is an empty array. Values can be accessed by: a[0] = 10