A struct is a collection of fields. It is useful for grouping data together to form records. Go is object-oriented but uses structs and methods instead of classes.
Defining object models.
Defining and using structs.
type Vertex struct {
X int
Y int
}
func main() {
v := Vertex{1, 2}
v.X = 4
fmt.Println(v)
}
Use capitalized field names (e.g., `X` vs `x`) to export them to other packages.