Created
January 28, 2019 14:11
-
-
Save chaudharisuresh997/66d025b83006e437c5f5055d3d35908e to your computer and use it in GitHub Desktop.
Map Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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