Home

About

Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network
FAQHELPSITE MAPCONTACT US


  Advanced Search  

 
Learning Ruby Ruby Hashes
 

Summary: 2/3/2011
1
Learning Ruby
Ruby Hashes
Hashes
· Hashes introduce a new accessing method ­ similar to arrays
but indexing is by arbitrary keys of any type.
· Not magic Implemented as hash tables (like you learned
about in data structures)
· Unlike arrays, which associate object references with
numbered indices, hashes associate object references with
names/keys
· aka: "associative arrays", "maps" and "dictionaries"
· Hash entries are referred to as "key/value" or "name/value"· Hash entries are referred to as key/value or name/value
pairs
2/3/2011
2
Playing with hashes
favorites = {"class"=> "compilers",
"color" => "blue",

  

Source: Allan, Vicki H. - Department of Computer Science, Utah State University

 

Collections: Computer Technologies and Information Sciences