Print command - i need some explaination about it


the example

puts "text to search"
puts "text to redact"
words.each do |w|
print w+""

the thing that i don't understand is the print command that print ""
why we print like this (print w+"") instead of (print w)?
also what's the different between ( print w ) & ( print "#{w}" )?
i really hope some expert clear this to me

11 Iterating Over Arrays

Not really an expert about Ruby (in fact, currently taking this course) but I hope I'll help you a bit!:wink:

First of all, we are doing a loop using each method which is going to print each word in text with a space (that's why we use w+" ")separating each word using concatenation. In fact, w is like a variable that we add to a string. So, if we print print w, it will print every word stuck together.
Second of all, print w is different of print "#{w}" because in the first method, we print the variable and on the second, we print the variable inside of a string. Why the second method is more useful is that you can put text with the variable in a string instead of using concatenation like this:

print "Some text with a #{variable} inside of it!"


thank you soooooooo much
you cleared this for me...i feel content & refreshed now
it's was really bugging me since i started the course

thank you again for your help