Hash_Map module

get

procedureextensionsince 0.23.0Source

A copy of the key's value, or default if it is missing.

Example↗
Hash_Map :: #import "Extensions/Hash_Map";

map: Hash_Map.Map(string, int);
defer Hash_Map.deinit(*map);

Hash_Map.insert(*map, "a", 1);
assert(Hash_Map.get(*map, "a") == 1);
assert(Hash_Map.get(*map, "b", -1) == -1);
get :: (map: *Map, key: map.Key, default: map.Value = .{}) -> map.Value

Parameters

map: *Map
key: map.Key
default: map.Value = .{}

Returns

map.Value

See also