Getting started with Go — Maps

newMap := make(map[string]int)
var newMap = map[string]string{"testing":"test", "123":"1234"}
for key, value := range newMap{fmt.Println(key, value)
}
newMap["testing123123"] = "test_value"
results := newMap["testing123123"]
delete(newMap, "testing123123")
if elem, ok := newMap["testing123123]; ok{//If it does exist, do something
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matthew Boyd

Matthew Boyd

Learning, and posting my findings!