tour
tour copied to clipboard
tour: unnamed struct in example without any introduction
Context: https://go.dev/tour/moretypes/9
In this case you introduce the idea of an unnamed struct (without a type
) declared inline with a slice. It's not mentioned at all in the explanation nor introduced in any earlier chapter.
s := []struct {
i int
b bool
}{
{2, true},
{3, false},
{5, true},
{7, true},
{11, false},
{13, true},
}