Created
October 25, 2015 04:28
-
-
Save edvm/7434094961dcaa43e1fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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