Logo

Programming-Idioms

Assign to v the value stored in the map m for the key k.

Explain what happens if there is no entry for k in m.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
v := m[k]
v, ok := m[k]
v = m.get(k);
v = m.get(k);
m.getOrDefault(k, null);
local v=m[k]
$v = $m{$k};
$v = $m{$k} // 'foobar';
v = m[k]
v = m.get(k, "default value")
v = m.get(k)
v = m[k]