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
Hippocrates Lychros
6,258 Pointsextra credit / evaluating number of name characters
Dear All Yesterday I decided to discover Ruby. So after completing the first stage I tried to go through the extra credit task, about writing a simple program that outputs the number of characters of the name a user submits. Doing some research I found out that there exists a length method that does exactly that. However , the result I get is always incremented by one character, ie if I type the name 'John' instead of returning a value of 4 it returns 5. Any suggestions?
Thank you Hippocrates
1 Answer
James Barnett
39,199 PointsYou forgot to use chomp, to cut off the new line character, e.g. the enter key.
You can read more about chomp in the online book Learn to Program.
Hippocrates Lychros
6,258 PointsHippocrates Lychros
6,258 PointsThank you James, your advice solved the problem!!