Remove Key

Table of ContentsDown

 Maps - Remove Key

This Deluge task removes the specified key and associated value from the target map variable.




<map-variable>   refers to the target map variable from which the key is to be removed
<key-name>  is the key that is to be removed


Consider the below example:

  • A map variable map1 is declared.
  • Key-value pairs: John-India and David-USA, are added in it.
  • The pair John-India is removed, and map1 is displayed using the info task.
map1 = map();
map1.put("John", "India");
map1.put("David", "USA");
info map1;

Output will be {"David":"USA"}.