Add a key to map if it does not exist

Map.put_new(my_map, :key, value) will only put the key/value if the key does not exist in the map.

5 Likes