DEV Community

Joshua Jones
Joshua Jones

Posted on

Arrays and Hashes in Ruby

access by index:
Image description

Arrays can be 2d, 3d

Hashes: Values are assigned to keys using =>.
Image description

Hash.new: creates a new, empty Hash. It's the same as setting the variable equal to the empty curly braces ({})

Adding to the hash:
Image description

Iterating over Arrays:
Image description

iterating over hashes:

Image description

Create a HISTOGRAM:

Image description

Top comments (0)