Arrays automatic length
- [...]
There was a slight duplication of information in the above example as we could have deducted the size from the list of initial values. This happens with the 3 dots.
package main
import (
"fmt"
)
func main() {
var res = [...]int{7, 5, 9}
fmt.Println(res)
fmt.Println(res[1])
fmt.Println(len(res))
fmt.Printf("%T\n", res)
}
[7 5 9]
5
3
[3]int