Skip to main content
Version: 1.4.0

Adding

Adding a binding to a map is done by calling the function Map.add. If the key was already present in the given map, the corresponding value is updated.

const my_map: map<int,string> = Map.literal(list([[1,"one"],[2,"two"]]));
const new_map = Map.add(3, "three", my_map);
const contains_3 = Map.mem(3, new_map); // == true

Note: See the predefined namespace Map