Login
|
Signup
langref.org
-
ruby
add..
all
clojure
cpp
csharp
erlang
fantom
fsharp
go
groovy
haskell
java
ocaml
perl
php
python
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Maps
Access
Retrieve a value from a map
Given a map pets
{joe:cat,mary:turtle,bill:canary}
print the pet for
"joe"
(
"cat"
)
ruby
puts map['joe']
map = {'joe'=>'cat', 'mary'=>'turtle', 'bill'=>'canary'}
puts map['joe']
Submit a new solution for
ruby
There are 27 other solutions in
additional
languages (
clojure
,
cpp
,
erlang
,
fantom
...)