To create a map with a key and value of type int in Go, you can use the built-in make() function. Here's an example code snippet:
main.go125 chars4 lines
In this example, myMap
is declared as a map with string type keys and int type values. You can set a value for a key by assigning a value using the key as the index in the map. To retrieve a value for a specific key, use the key as the index and assign the result to a variable.
gistlibby LogSnag