I am going through the following Go Lang Map data structure. I am little confused with the syntax -
//this is fine
countryCapitalMap = make(map[string]string)
/* insert key-value pairs in the map*/
countryCapitalMap["France"] = "Paris"
capital, ok := countryCapitalMap["United States"]
/* print map using keys*/
for country := range countryCapitalMap {
fmt.Println("Capital of", country, "is", countryCapitalMap[country])
}
Is it that the countryCapitalMap["United States"] returns two return values from the following line
capital, ok := countryCapitalMap["United States"]
Or countryCapitalMap[country] returns single value from the following line
fmt.Println("Capital of", country, "is", countryCapitalMap[country])
How could I decipher this syntax? Is it based on where and which statement the expression is used with?