Ruby program to scan name of user and say hello with name


Following program shows you how to scan name of user and say hello with name
In this program we get name from user using gets method and prints hello with that name using puts

puts "Please enter your name:"
name = gets
puts "Hello " + name

Output:

Please enter your name:
Tom
Hello Tom