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 Strings String Concatenation

im not sure how to complete this

it says i need a space but i included a space already

program.rb
def ruby(rocks)
puts "ruby" + "rocks"
end


puts "ruby" + "rocks"

5 Answers

Rogier Nitschelm
seal-mask
.a{fill-rule:evenodd;}techdegree
Rogier Nitschelm
iOS Development Techdegree Student 5,461 Points

There is no space in the code you have shown. But you could easily add a space:

puts "ruby rocks"
puts "ruby" + " rocks" 
puts  "ruby rocks"

However - the function signature has a parameter (rocks). Which suggest you have to do something with that. I cannot tell by your question what problem you're supposed to solve, however - I can imagine it could be something like:

def ruby(rocks)
   puts "ruby #{rocks}"
end

There is no parameter, you are just joining two strings and printing them. You can use puts to print them, you need to add a plus operator with empty quotes to create a space between the strings.

puts "Ruby" + " " + "rocks!"

You need to add and extra set of elements=> + " " + between ruby and rocks. It would look something like this:

def ruby(rocks) puts "ruby" + "rocks" end

puts "ruby" + " " + "rocks"

the question was, Using string concatenation, join the strings "Ruby" and "rocks!" together. Be sure to include a space between "Ruby" and "rocks!". Then print the result using puts. i still cannot figure out how to complete it.