Mega Code Archive

 
Categories / Ruby / Hash
 

You can use the length method on hashes just as you can on arrays

pizza = {"first_topping" => "pepperoni", "second_topping" => "sausage"} puts pizza.length