I’ve just started to learn ruby and this is probably very easy to solve. How do I compare two strings in Ruby?
I’ve tried the following :
puts var1 == var2 //false, should be true (I think)
puts var1.eql?(var2) //false, should be true (I think)
When I try to echo them to console so I can compare values visually, I do this :
puts var1 //prints "test content" without quotes
puts var2 //prints ["test content"] with quotes and braces
Ultimately are these different types of strings of how do I compare these two?
From what you printed, it seems
var2is an array containing one string. Or actually, it appears to hold the result of running.inspecton an array containing one string. It would be helpful to show how you are initializing them.