ruby write a hash with value code example
Example 1: how to make a new hash ruby
my_hash = Hash.new #=> { }
# OR
my_hash = {}
Example 2: ruby assign value to hash
grades = Hash.new
grades["Dorothy Doe"] = 9
my_hash = Hash.new #=> { }
# OR
my_hash = {}
grades = Hash.new
grades["Dorothy Doe"] = 9