Created
June 24, 2019 13:27
-
-
Save victorsteven/ed4708f8aad65705b94557b4e9586176 to your computer and use it in GitHub Desktop.
This file contains hidden or 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" | |
| var nameAgeMap map[string]int | |
| func main() { | |
| nameAgeMap = map[string]int{ | |
| "James": 50, | |
| "Ali": 39, | |
| } | |
| fmt.Println("Print the age of James: ", nameAgeMap["James"]) | |
| //We can range through the map and print each value: | |
| for key, value := range nameAgeMap { | |
| fmt.Printf("%v is %d years old\n", key, value) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment