Skip to content

Instantly share code, notes, and snippets.

@edvm
Created October 25, 2015 04:28
Show Gist options
  • Save edvm/7434094961dcaa43e1fe to your computer and use it in GitHub Desktop.
Save edvm/7434094961dcaa43e1fe to your computer and use it in GitHub Desktop.
package main
import "fmt"
func keys(m map[string]int) ([]string, int) {
var keys = []string{}
var c int = 0
for key, _ := range m {
keys = append(keys, key)
c += 1
}
return keys, c
}
func main() {
m := map[string]int{
"Emi": 29,
"Memo": 30,
}
k, c := keys(m)
fmt.Printf("keys %v values %v", k, c)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment