Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Nick Evershed
6,415 PointsDifferent output
def create_list print "What is the list name? " name = gets.chomp
hash = { "name" => name, "items" => Array.new }
return hash
end
def add_list_item print "What is the item called? " item_name = gets.chomp
hash = { "name" => item_name } return hash end
list = create_list() puts list.inspect
add_list_item().inspect
I have copied what he did in the video exactly, but for some reason whenever I type the item the program ends and dosen't display name ==> "(What I typed)"
3 Answers

KRIS NIKOLAISEN
54,668 PointsIf you check the video @ 18 seconds he enters
puts add_list_item().inspect
you just have
add_list_item().inspect

Jeff Muday
Treehouse Moderator 27,547 PointsThat's a very simple fix, drop in a "puts" in front of the last add_list_item().inspect and you will have it.
Ruby is a super cool language, enjoy!
def create_list
print "What is the list name? "
name = gets.chomp
hash = { "name" => name, "items" => Array.new }
return hash
end
def add_list_item
print "What is the item called? "
item_name = gets.chomp
hash = { "name" => item_name }
return hash
end
list = create_list()
puts list.inspect
puts add_list_item().inspect # you needed a puts here

Nick Evershed
6,415 PointsYea Ruby seems like the perfect language for me, anyways thanks guys :)
Jeff Muday
Treehouse Moderator 27,547 PointsJeff Muday
Treehouse Moderator 27,547 PointsKris, you beat me to another answer! You are the fastest gun in the west!