DEV Community

Grace Do
Grace Do

Posted on

Shovel operation in Ruby

An alternative way for string concatenation.

str1 = "This is a new string"
str2 = ". This is a new sentence."
result = str1 << str2
puts result
Enter fullscreen mode Exit fullscreen mode

Output:

This is a new string. This is a new sentence.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)