Source file tour/moretypes/slice-literals.go

     1  //go:build OMIT
     2  
     3  package main
     4  
     5  import "fmt"
     6  
     7  func main() {
     8  	q := []int{2, 3, 5, 7, 11, 13}
     9  	fmt.Println(q)
    10  
    11  	r := []bool{true, false, true, true, false, true}
    12  	fmt.Println(r)
    13  
    14  	s := []struct {
    15  		i int
    16  		b bool
    17  	}{
    18  		{2, true},
    19  		{3, false},
    20  		{5, true},
    21  		{7, true},
    22  		{11, false},
    23  		{13, true},
    24  	}
    25  	fmt.Println(s)
    26  }
    27  

View as plain text