// You can edit this code!
// Click here and start typing.
package main
func main() {
keys := []string{"foo", "bar", "foo"}
m := make(map[string]string)
for _, k := range keys {
p, ok := m[k]
if !ok {
p = "value of " + k
m[k] = p
} else {
continue
}
println(p)
}
}
Playground link: https://go.dev/play/p/QaA_67_EhZ-