Hashes

“Hashing Around”

Photo by Nicole Wolf on Unsplash
{}hash_name = {'name' => 'Logan', 'favorite color' => 'Yellow'}
hash_name["name"]

Creating a |key, value| pair

Photo by Silas Köhler on Unsplash
new_hash = {a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}

To get the value for key e above you can do this:

new_hash[:e]
new_hash[:b] = 9new_hash[:name] = "Professor X "
new_hash.keys
new_hash.values
Photo by Ricardo Gomez Angel on Unsplash

Iterating Through A Hash

Learn how to find the methods

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store