Simple example of Map initialization in Go
The literal mapped values are specified using a colon-separated pair of key and value as shown in below example.
Example
package main
import "fmt"
var employee = map[string]int{"Mark":10,"Sandy":20}
func main() {
fmt.Println(employee)
}
Output
map[Mark:10 Sandy:20]
Most Helpful This Week
Example: ReadAll, ReadDir, and ReadFile from IO Package
How to check pointer or interface is nil?
Example: Split, Join, and Equal from BYTES Package
How to check lowercase characters in a string in Golang?
How to check if a string contains a numbers in Golang?
The return values of a function can be named in Golang