Go code
ages := map[string]int{"Maya": 12}
fmt.Println(ages["Maya"])Line-by-line explanation
- The map uses string keys and int values.
- Maya maps to 12.
- Square brackets look up the key.
Expected output
12This is the expected result.