“When you deleted the key, it gave you the value back!”
Jim nodded. “That’s what the
delete method does!” he said. “That way, if we had wanted to use the value of the deleted key for something, we could have saved it into a variable, like this:
When you delete a key from a hash with the .delete method it returns the value. You can set a variable equal to the menu_drinks.delete(drinks) so you can capture the reutrned value!
Share this highlighthttp://www.safaribooksonline.com/a/ruby-wizardry/52255/