Check if key exists (comma-ok)
Safely checks if a key exists.
Syntax
value, ok := harita[key]
Description
The second return value (ok) tells whether the key exists (true/false).
Example
Loading editor…
Expected output
false
When to use?
Handling missing keys safely.