clear method removes all the key-value pairs from a hash, leaving it empty : clear « Hash « Ruby






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


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

 

Related examples in the same category

1.clear a hash