Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. def create_list
  2. print "what is the list name? "
  3. name = gets.chomp
  4.  
  5. hash = {"name" => name, "items" => Array.new}
  6. return hash
  7. end
  8.  
  9. def add_list_item
  10. print "what is the item called?"
  11. item_name = gets.chomp
  12.  
  13. print "How Much? "
  14. quantity = gets.chomp.to_i
  15.  
  16. hash = {"name" => item_name, "quantity" => quantity[]}
  17. return hash
  18. end
  19.  
  20. list = create_list()
  21. puts list.inspect
  22.  
  23. puts add_list_item().inspect
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement