How to concatenate the strings in Ruby
In this post we will give you information about How to concatenate the strings in Ruby. Hear we will give you detail about How to concatenate the strings in RubyAnd how to use it also give you demo for it if it is necessary.
we are going to learn about how to concatenate the strings in Ruby.
Concatenation means the joining of two or more strings into a single string.
Using ”+” operator
To concatenate the two strings into a single string, we can use the addition operator + in Ruby.
Here is an example:
first = "alex"second = "pop"full_name = first + secondputs full_name
Output:
"alexpop"
Similary, we can also append a string to an existing string using the concat() method in Ruby.
name = "alex"name.concat("pop")puts name
Hope this code and post will helped you for implement How to concatenate the strings in Ruby. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs