Ruby - Operators and Expressions
What will this Ruby code print?
class Word
def initialize(text)
@text = text
end
def +(other)
@text + " " + other
end
end
w = Word.new("Hello")
puts w + "World"