All help topics · Link to this topic
Showing help on 'mapdelete()'
Syntax: mapdelete (MAP map, MIXED key|LIST keys)Returns a copy of map with the value(s) corresponding to the specified key(s) removed. A single key or a list of keys can be provided.
If a key is a collection value, such as a list or map, then E_TYPE is raised. If a key is valid but is not present in the map, then E_RANGE is raised. When deleting a list of keys, the E_RANGE value identifies the first missing key.
x = ["foo" -> 1, "bar" -> 2, "baz" -> 3, "qux" -> 4];
mapdelete(x, "bar") => ["baz" -> 3, "foo" -> 1, "qux" -> 4]
mapdelete(x, {"bar", "qux"}) => ["baz" -> 3, "foo" -> 1]