Changing Hashes
# Hash's []= method replaces or adds key-value pairs to an existing hash.
myHash = { 1 => "One", 2 => "Two", 3 => "Three", 4 => "Four",5 => "Five" }
# You can use []= to add a pair to this array:
myHash = { 1 => "One", 2 => "Two", 3 => "Three", 4 => "Four", 5 => "Five" }
myHash[6]= "Six"
Related examples in the same category