Go code
ages := map[string]int{"Maya": 12}
age, ok := ages["Noah"]
fmt.Println(age, ok)Line-by-line explanation
- The map has only Maya.
- The lookup requests Noah.
- Age receives int’s zero value.
- Ok receives false because the key is absent.
Expected output
0 falseThis is the expected result.