March 2019
Intermediate to advanced
336 pages
9h 9m
English
A dictionary has a remove method, as shown in the following code, which has a key parameter of the DictKey type. This method returns a bool value if the value associated with Dictkey is removed from the map:
// Remove methodfunc (dict *Dictionary) Remove(key DictKey) bool { dict.lock.Lock() defer dict.lock.Unlock() var exists bool _, exists = dict.elements[key] if exists { delete(dict.elements, key) } return exists}
Read now
Unlock full access