Hashes in Ruby are a helpful way to organize information. As can be seen in the screenshot below, I’ve created a new hash, named it example, and given it a couple keys and values to start. To create your own hash, just pick the name you want it to be called and set that equal to Hash.new. Since Ruby is case-sensitive, it’s important to remember to capitalize Hash.new. To set keys and values, use the format: hashname[“key”] = “value”. In my example hash, I’ve created the keys “cold” and “hot” and given them values of “pluto” and “sun” respectively.
Next, you can get input from the user and add it to the hash as a key or a value.