clear a hash : clear « Hash « Ruby






clear a hash


counties = { "Three" => 3, "Five" => 5 }
counties.clear # bye-bye

 

Related examples in the same category

1.clear method removes all the key-value pairs from a hash, leaving it empty