[solved]learning ruby

Questions about programming languages and debugging
Post Reply
User avatar
computathug
Administrator
Administrator
Posts: 2693
Joined: 29 Mar 2007, 16:00
17
Location: UK
Contact:

[solved]learning ruby

Post by computathug »

i am going through a book then doing the test's and have run into a problem at the first hurdle.

Code: Select all

puts 'What is your first name?'
my_first_name=gets
puts 'what are your middle names?'
my_middle_name=gets
puts 'what is your last name?'
my_last_name=gets.chomp
puts 'Pleased to meet you '.+my_first_name+my_middle_name+my_last_name+'.'
all works but i cant get the last bit where it adds all together onto the same line. I don't want to move onto the next one till i get this right as that would be defeating the object.

Code: Select all

puts 'What is your first name?'
my_first_name=gets.chomp
puts 'what are your middle names?'
my_middle_name=gets.chomp
puts 'what is your last name?'
my_last_name=gets.chomp
puts 'Pleased to meet you, '.+my_first_name+''+my_middle_name+''+my_last_name+'.'

Code: Select all

puts 'What is your first name?'
my_first_name=gets.chomp
puts 'what are your middle names?'
my_middle_name=gets.chomp
puts 'what is your last name?'
my_last_name=gets.chomp
puts 'Pleased to meet you, '+my_first_name +' '+my_middle_name+' '+my_last_name+'.'

Post Reply