Hacker News new | past | comments | ask | show | jobs | submit login

Golang maps do not return nil for missing values of maps. Referencing a missing value in map returns the zero value for the value type, which for int is 0, for string is the empty string "", bools are false, and so forth. Golang also has the two-return-value form of map reference:

  value, exists = myMap[42]



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

Search: