Skip to content

Instantly share code, notes, and snippets.

@chaudharisuresh997
Created January 28, 2019 14:11
Show Gist options
  • Save chaudharisuresh997/66d025b83006e437c5f5055d3d35908e to your computer and use it in GitHub Desktop.
Save chaudharisuresh997/66d025b83006e437c5f5055d3d35908e to your computer and use it in GitHub Desktop.
Map Demo
package main
import (
"fmt"
u "model"
)
func MapDemo() {
var r1 = make(map[string]string)
r1["s"] = "s"
//access map
fmt.Println(r1["s"])
//iterate map
for key, value := range r1 {
fmt.Println("Key:", key, "Value:", value)
}
}
func main() {
u.Disp()
MapDemo()
var o = u.P{"shiv"}
fmt.Println(o.Name)
u.Echo() //function from interface
fmt.Println("Shiv")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment