map.remove() - Pine Script Function
map.remove()
Section titled “map.remove()”Overview
Section titled “Overview”Removes a key-value pair from the id map.
Syntax
Section titled “Syntax”map.remove(id, key) → <value_type>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any map type | A map object. |
Returns
Section titled “Returns”The previous value associated with key if the key was present in the map, or na if there was no such key.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("map.remove example")a = map.new<string, color>()a.put("firstColor", color.green)oldColorValue = map.remove(a, "firstColor")plot(close, color = oldColorValue)