DeleteMapElement()

Syntax

DeleteMapElement(Map() [, Key$])
Description
Removes the current element from the specified 'Map()'. 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, the element associated to this key will be deleted from the map (if it exists). There will be no more current element after this call.

Example:
  NewMap Country.s()

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

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

Supported OS

All

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