$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · easy · #218

What is the output?

m := map[string]int{}
m["a"]++
fmt.Println(m["a"], m["b"])
  1. 1 0
  2. 0 0
  3. 1 1
  4. panic
Reading a missing key yields the zero value, so m["a"]++ starts from 0 and m["b"] prints 0.
Play Problem Solving ▸