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

Code works in Workspaces but not in Powershell and Notepad++

print "How old are you? " age = gets.chomp

This works using workspaces. When I run it via notepad++ and/or Powershell the code doesnt work. I get a blank line when I run it, I enter the number for the age and then the "How old are you" shows up/

Would greatly appreciate any help.

Thanks.

This is because you are printing "How old are you?"

Try this:

print "How old are you?" age = gets.chomp print age

The reason for this is because you are never output the result of age which "gets" user input.