Ruby hashes and arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answer
+ 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