+ 3
Question 4 under hashes & symbols
wat are hashes use for
2 Antworten
+ 3
Hashes are MUCH faster than arrays at grabbing a specific variable.
Hashes are typically unordered. Imagine 2 file cabinets, one is an array and one is a hash.
Inside the array cabinet, all the folders are unmarked so, if you want to find a folder, you have to know where you put it OR go through ALL of them until you find it.
Inside the hash cabinet, all the folders have tabs with labels (or "keys"). This way, you want to find something, you just have to look for the label and you're done.
UPDATE: In Ruby, Hashes are ordered by default.
0
to get the header file contents