This language bar is your friend. Select your favorite languages!

Idiom #172 Insert entry in map

Insert value v for key k in map m.

(assoc m k v)
m[k] = v;
m[k] = v;
m[k] = v;
m[k] = v;
m[k] = v
m.k = v
m[k] = v
import qualified Data.Map as Map
newM = Map.insert k v m
m[k] = v;
m.set(k, v);
m.put(k, v);
$m[$k] = $v;
m.KeyData[k] := v;
$m{$k} = $v;
m[k] = v
m[k] = v
use std::collection::HashMap;
m.insert(k, v);

Do you know the best way to do this in your language ?
New implementation...

Idiom created by


Related idioms