+ 1

Ruby hashes and arrays

What is the diffrent between hashes and arrays? Are there any diffrents? Do you use them in a diffrent way

20th Feb 2017, 8:15 AM
Ivo Borer
Ivo Borer - avatar
1 Odpowiedź
+ 4
Hashes are like arrays except that it has values for example :"Bob" => 21, "David" => 12 hashes are good for keeping ages or money values from people or anything else, while array contains maybe string, float, or integer [31, 45, 72, "Bob", 1.11] In array you cant give a specific item a value.
20th Feb 2017, 1:09 PM
MrCoder
MrCoder - avatar