Skip to content

Instantly share code, notes, and snippets.

@rdp
Created April 23, 2014 16:51
Show Gist options
  • Save rdp/11223234 to your computer and use it in GitHub Desktop.
Save rdp/11223234 to your computer and use it in GitHub Desktop.
demo of iterating over "just the keys" in a golang map
package main
import "fmt"
func main() {
m := map[string]string{ "key1":"val1", "key2":"val2" };
for k := range m {
fmt.Println("key is:" + k)
}
}
@rdp
Copy link
Author

rdp commented Apr 23, 2014

output is

key is:key1
key is:key2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment