Golang ProgramsGolang Programs

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.
package main

import "fmt"

var employee = map[string]int{"Mark":10,"Sandy":20}

func main() {
    fmt.Println(employee)
}

C:\golang\maps>go run example1.go
map[Mark:10 Sandy:20]

C:\golang\maps>