Go Arrays
In Go, an array is a numbered sequence of elements of a single type with a fixed length.
1. Basic Usage
The size of the array is part of its type. [5]int and [10]int are distinct, incompatible types.
2. Multi-Dimensional Arrays
You can compose types to build multi-dimensional data structures.
3. Iterating with Range
Use range to iterate over an array. If you don't need the index, use the blank identifier (_).
Important Notes
- Value Type: Arrays in Go are value types. If you assign an array to a new variable, or pass it to a function, the entire array is copied.
- Fixed Size: You cannot resize an array. If you need a dynamic list, use Slices instead (which are much more common in Go).