I'm trying to figure out how to print just the key in a Hash right now. I'm still new to this and I'm missing something on how to just print the key. My code so far:
shopping_list = {
'milk' => false,
'eggs' => false,
'jalapenos' => true
}
puts "Here is your shopping list!"
shopping_list.each do |key|
puts "- #{key}"
end
My output:
Here is your shopping list!
- ["milk", false]
- ["eggs", false]
- ["jalapenos", true]
I just want to value to print out like:
Here is your shopping list!
- milk
- eggs
Eventually, I would like to leave out the true shopping item, in this instance, it would already be purchased. I would like to print out what I still need to buy first.