Ruby | String + Method
+() is a String class method in Ruby which is used to return a new string that contains the other specified string concatenated to the given string.
Syntax: str + other_str
Parameters: Here, str and other_str are the strings which are to be concatenated.
Returns: Returns the concatenated string.
Example 1:
#ruby 2.3.1 # Ruby program to demonstrate # the + method # Taking a string and # using the method puts "Hello " + "Geeks!"puts "Ruby " + "String" |
chevron_right
filter_none
Output:
Hello Geeks! Ruby String
Example 2:
#ruby 2.3.1 # Ruby program to demonstrate # the + method # Taking a string and # using the method puts "Hey " + "Champ"puts "Kirti " + "Mangal" |
chevron_right
filter_none
Output:
Hey Champ Kirti Mangal
Recommended Posts:
- Ruby | String =~ Method
- Ruby | String == method
- Ruby | String << Method
- Ruby | String * Method
- Ruby | String eql? Method
- Ruby | String === Method
- Ruby | String <=> Method
- Ruby | String chr Method
- Ruby | String hex Method
- Ruby | String getbyte Method
- Ruby | String chomp Method
- Ruby | String bytesize method
- Ruby | String grapheme_clusters Method
- Ruby | String byteslice Method
- Ruby | String dump Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

