Given an empty pets map, add the mapping from
"rob" to
"dog"
ruby pets['rob']='dog'
pets = []
pets['rob']='dog'
clojure (assoc {} 'rob 'dog)
(assoc {} 'rob 'dog)
cpp C++/CLI .NET 2.0pets->Add("rob", "dog");
using namespace System;
using namespace System::Collections;
int main()
{
Hashtable^ pets = gcnew Hashtable;
pets->Add("rob", "dog");
}
cpp C++/CLI .NET 2.0pets["rob"] = "dog";
using namespace System;
using namespace System::Collections;
int main()
{
Hashtable^ pets = gcnew Hashtable;
pets["rob"] = "dog";
}
Submit a new solution for
ruby,
csharp,
clojure, or
cpp
There are 18 other solutions in
additional languages (
erlang,
fantom,
fsharp,
go ...)