The source code to concatenate the strings using the "<<" operator is given below. The given program is compiled and executed successfully.
# Ruby program to concatenate the
# strings using "<<" operator
str1 = "Hello ";
str2 = "how ";
str3 = "are you. ";
str1 << str2 << str3;
print str1;
Output:
Hello how are you.
Explanation:
In the above program, we created three strings str1, str2, str3, that are initialized with "Hello ", "how ", "are you ". Then we concatenated the strings using the "<<" operator and printed the result.
Program/Source Code:
The source code to concatenate the strings using the "<<" operator is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we created three strings str1, str2, str3, that are initialized with "Hello ", "how ", "are you ". Then we concatenated the strings using the "<<" operator and printed the result.
need an explanation for this answer? contact us directly to get an explanation for this answer