Beginner
Go (Golang)
Q35 / 100
How do you check if a key exists in a map?
Correct! Well done.
Incorrect.
The correct answer is B) val, ok := m["key"]; if ok { }
B
Correct Answer
val, ok := m["key"]; if ok { }
Explanation
The two-value map access val, ok := m[key] sets ok to false (and val to zero value) if key is absent.
Progress
35/100