ruby - Using a method to puts variables -


i want use capitalize method , puts string user input.

puts "what name?" name = gets.chomp puts "hi, " name.capitalize "how you?" 

here error after line 2:

syntax error, unexpected tidentifier, expecting $end puts "hi, " name.capitalize "how you?"

you need concatenate strings or interpolate. options are:

puts "what name?" name = gets.chomp puts "hi, " + name.capitalize + " how you?" 

or

puts "what name?" name = gets.chomp puts "hi, #{name.capitalize} how you?"