Use len() to get the number of elements in an array:
numbers := [5]int{1, 2, 3, 4, 5}
fmt.Println(len(numbers)) // 5
The length is known at compile time for arrays, but len() still works. It becomes more useful with slices where the length can change. Using len() in loops prevents off-by-one errors.