Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can test for existence:

    val, ok := my_map[123]
    if ok {
        ...
    }
https://go.dev/blog/maps#working-with-maps


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: