Literal
Composite literals
Composite literals construct struct, array, slice or map values. Keys represent field names, indices or map keys depending on type. Omitted array or struct elements have zero values. Example output: '[0 7 0] [2 4]'.
Formal Syntax & Structure
go syntaxgo
T{ elements }Working Example
Example Snippetgo
package main
import "fmt"
func main() { fmt.Println([3]int{1: 7}, []int{2, 4})}