Answer the question
In order to leave comments, you need to log in
How to idiomatically increment a value in a map?
package main
//Создаем структуру
type Item struct {
Data string
Count int
}
func main() {
//сделали мапу
c := make(map[int]Item)
//заполнили мапу двумя значениями
c[10] = Item{"asdf", 1}
c[20] = Item{"fghj", 1}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question