I just started learning how to code and I am following along Chris Pine’s tutorial on Ruby. I completed an exercise that had me print out my first name then my middle name and then my last name and then finally had me greet me using my full name. I did everything correctly except at the very end I printed out my full name like this: ParkerJacobsPreyer I was just wondering how to make sure the output of those variables would be spaced correctly? Here is the relevant line of code:
puts 'Well it was great to meet you ' + name + middleName + lastName
Instead of using addition to concatenate the strings, use string interpolation:
Note that for the
#{variable}syntax to work, you must use double quotes (") instead of single quotes (').