Maps and Structs in golang

1 · Maksym Postument · Dec. 3, 2022, 2:46 p.m.
Hello! The topic of today’s post is about maps and structs. Lets start start with maps Maps Create map Maps is a data structure in which data is specified in pairs, keys, and values. In golang it is created as follows. map[KEY_TYPE]VALUE_TYPE. import "fmt" func main() { studentsGrades := map[string]int{"John": 50, "Alex": 70} fmt.Println(studentsGrades) } $ go run main.go map[Alex:70 John:50] Another option is to create a map using the make keyword...