“Ve a buscar del mapa” Código de respuesta

Inicializar el mapa en Golang

// By default maps in Go behaves like a default dictionary in python
m := make(map[string]int)

m["Dio"] = 3
m["Jonathan"] = 1
Joseph Joestar

Ve a agregar al mapa

m := make(map[string]int)
m["numberOne"] = 1
m["numberTwo"] = 2
Navid2zp

Ve a buscar del mapa

var id string
var ok bool
if x, found := res["strID"]; found {
     if id, ok = x.(string); !ok {
        //do whatever you want to handle errors - this means this wasn't a string
     }
} else {
   //handle error - the map didn't contain this key
}
Average Angelfish

Respuestas similares a “Ve a buscar del mapa”

Preguntas similares a “Ve a buscar del mapa”

Más respuestas relacionadas con “Ve a buscar del mapa” en Go

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código