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 Ruby Basics (Retired) Ruby Strings What are Strings?

Zolbayar Orshil
Zolbayar Orshil
9,838 Points

I am trying to get few inputs from user and puts them out but it asks only one time and does't ask anymore help

prints "what is ur name?"
name = gets
prints "how old are you?"
age = gets 
prints " what is ur job ?"
job = gets

somehow in console it does ask only the first one and stop asking but still getting the info from user without asking the second and third questions. please help out guys

**MOD note: Added Markdown to the code snippet for easier readability.

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Zolbayar,

The problem you are having is because you have prints with an 's.' You are probably thinking of puts which has an 's,' but it is just print -- no 's'

It is also a good idea to use gets.chomp instead of just gets. For this little bit of code, it wouldn't make a difference, but with a larger more interactive program it could cause issues. The gets grabs and stores the input as is, so if someone typed "Jason         ", that is what will get stored (whitespace and all). The gets.chomp only grabs legitimate input and will not take all that whitespace.

Hope that helps and makes sense. Keep Coding! :)