Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Will declare a map of string keys, int values.
- var timeZone = map[string]int{
- "UTC": 0*60*60,
- "EST": -5*60*60,
- "CST": -6*60*60,
- "MST": -7*60*60,
- "PST": -8*60*60,
- }
- //You can create a set-like structure using a map by setting the value of each key to bool.
- attended := map[string]bool{
- "Ann": true,
- "Bobby": true
- }
- //This is useful now because you can check for existence in the map
- if attended[somePerson] { //Will return false if somePerson isn't in the map
- fmt.Printf("%v was present.\n")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement