View Problem

Retrieve a value from a map

Given a map pets {joe:cat,mary:turtle,bill:canary} print the pet for "joe" ("cat")
ExpandDiskEdit
ruby
puts map['joe']
ExpandDiskEdit
cpp C++/CLI .NET 2.0
if (pets->ContainsKey("joe")) Console::WriteLine(pets["joe"]);
ExpandDiskEdit
cpp
cout << pets["joe"] << endl;

Submit a new solution for ruby, csharp, or cpp
There are 25 other solutions in additional languages (clojure, erlang, fantom, fsharp ...)