Golang (Go) Tutorial - Maps - Key-Value Pairs
πΊοΈ Maps - Dictionary
Real Life:
π Dictionary: Word β Meaning
π Contacts: Name β Phone
π° Price List: Item β Price
Syntax
// Create map
prices := make(map[string]int)
prices["apple"] = 50
// Or
scores := map[string]int{
"Rohan": 95,
"Simran": 88,
} Example
ages := map[string]int{
"Rohan": 25,
"Simran": 22,
}