Result = DeleteMapElement(Map() [, Key$])
Removes the current element or the element with the given key from the specified map.


Map() The map to use.
Key$ (optional) The key for the item to remove. If this is not specified, then the current element of the map is removed.

Return value

Returns the memory address of the new current element of the map. If the map has no current element after the deletion, the result is 0.


After this call, the new current element is the previous element (the one before the deleted element), which is an arbitrary element, as a map isn't sorted. If that element does not exist (in other words, you deleted the first element in the map) then there is no more current element, as it will be before the first element, like after a ResetMap(). If there was only one element in the map when you deleted it then you are left with no current element!

If the optional 'Key$' parameter is specified then there will be no more current element after this call.


  NewMap Country.s()

  Country("US") = "United States"
  Country("FR") = "France"
  Country("GE") = "Germany"

  ; Delete a country
  DeleteMapElement(Country(), "FR")
  ForEach Country()
    Debug Country()

See Also

AddMapElement(), ClearMap(), MapSize()

Supported OS


<- CopyMap() - Map Index - FindMapElement() ->