Ruby/Hash/Key value

Материал из Wiki.crossplatform.ru

Версия от 17:57, 13 сентября 2010; ViGOur (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

objects within a hash are given a key that points to them.

dictionary = { "cat" => "feline animal", "dog" => "canine animal" }



The variable storing the hash is dictionary, and it contains two entries

dictionary = { "cat" => "feline animal", "dog" => "canine animal" }
 
puts dictionary.size