Mega Code Archive

 
Categories / Ruby / Hash
 

Adds the value Six with a key 6 Or you can use []= to change a value

myHash = { 1 => "One", 2 => "Two", 3 => "Three", 4 => "Four", 5 => "Five" } myHash[2]= "Bent"