Skip to content

Instantly share code, notes, and snippets.

@mchirico
Created March 22, 2014 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mchirico/9699097 to your computer and use it in GitHub Desktop.
Save mchirico/9699097 to your computer and use it in GitHub Desktop.
Simple map in golang
package main
//http://play.golang.org/p/0KdITlFYrV
import "fmt"
func main() {
H := make(map[string]int)
for i := 0; i < 3; i++ {
s := fmt.Sprintf("one%d", i)
H[s] = H[s] + 1
}
H["one1"] = H["one1"] + 1
for k, v := range H {
fmt.Println(k, v)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment