logo image

Ruby program to Join two given strings



Following program shows you how to Join two given strings. In this program we get strings from user and join those strings

puts "Please enter the first string:"
string1 = gets.to_s.strip
puts "Please enter the second string:"
string2 = gets.to_s.strip
output = string1 + string2
puts "Joined string is: #{output}"

Output:

Please enter the first string:
hello
Please enter the second string:
world
Joined string is: helloworld