Slices of Struct


Example to create Slices of Struct

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main
 
import "fmt"
 
type Claims struct {
    ClaimNumber string
    BatchName   string
    bookmarks   []string
}
 
func main() {
    fmt.Println("Welcome to Struct ")
    myclaims := []Claims{
        {"PC101", "Batch101", []string{"Denied,OutOfNetwork"}},
        {"PC102", "Batch101", []string{"Denied,onHold"}},
    }
 
    fmt.Printf("%s", myclaims)
}