Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Tyler _
Tyler _
6,651 Points

hi, what is wrong with my code?

def intro

    name = gets "What is your name? "
    age = gets "what is your age? "
    favorite_books = gets "what is your favorite book? "

    puts "Thanks for entering your info, I see your name is #{name}, age is #{age}, /n
    and favorite book is #{favorite_books}." 

    return name,age,favorite_books

end

How are you calling the method?

2 Answers

Owen Tran
Owen Tran
6,822 Points

puts "What is your name? "

name = gets.chomp

puts "what is your age? "

age = gets.chomp

puts "what is your favourite book? "

favourite_books = gets.chomp

Tyler _
Tyler _
6,651 Points

Thanks Owen, now I'm trying to expand into using a method with my program. I still don't quite understand how to incorporate methods.