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

Lee Hughes
Lee Hughes
8,380 Points

Simple interactive program problems

I'm trying to write my own very simple programs but for some reason I can't get this to work:

puts "What is your first name?"
first_name = gets.chomp
puts "What is your middle name?"
middle_name = gets.chomp
puts "What is your last name?"
last_name = gets.chomp 

puts "Did you know there are ' + first_name.length.to_s + ' characters in your first  name"
puts "and ' + middle_name.length.to_s + ' in your middle name"
puts "and ' + last_name.length.to_s + ' in your last name?"

I'm getting this back via the terminal:

Did you know there are ' + first_name.length.to_s + ' characters in your first name and ' + middle_name.length.to_s + ' in your middle name and ' + last_name.length.to_s + ' in your last name?

No doubt it's something simple but I don't see it. any advice?

Lee Hughes
Lee Hughes
8,380 Points

Never mind, I got it to run:

I needed to use single quotes for my puts so:

puts 'Did you know there are ' + first_name.length.to_s + ' characters in your first name'
puts 'and ' + middle_name.length.to_s + ' in your middle name'
puts 'and ' + last_name.length.to_s + ' in your last name?'