Slide 7
Slide 7 text
Создание таблицы
Создание таблицы
VS
VS
package main
package main
func main() {
func main() {
var m map[string]int
var m map[string]int
for _, word := range []string{"hello", "world", "from", "the",
for _, word := range []string{"hello", "world", "from", "the",
"best", "language", "in", "the", "world"} {
"best", "language", "in", "the", "world"} {
m[word]++
m[word]++
println(word, m[word])
println(word, m[word])
}
}
}
} Run
package main
package main
func main() {
func main() {
m := make(map[string]int)
m := make(map[string]int)
for _, word := range []string{"hello", "world", "from", "the",
for _, word := range []string{"hello", "world", "from", "the",
"best", "language", "in", "the", "world"} {
"best", "language", "in", "the", "world"} {
m[word]++
m[word]++
println(word, m[word])
println(word, m[word])
}
}
}
} Run
7
7