From: ChrisH Date: 2006-03-29T17:13:43+09:00 Subject: Re: How to 'space' certain things apart? JB wrote: > Hi, > > I'm trying to learn a programming language and this one came up in my > searches as a fairly easy one. I've never taken any courses and have > absolutely zero knowledge of programming or scripting. The main reason I want > to learn a language is just to simply make my own scripts for a MUD I play > online, heh. > > Anyway, I found a place to at least get me started and I had to do this > program below. The problem I'm having is that at the end, it shows the > persons name as, example: JimmySBrown instead of Jimmy S Brown. How do I get > it to add the two spaces I need? > > puts 'Please tell me your first name.' > first_name = gets.chomp > puts 'Please tell me your middle initial.' > middle_initial = gets.chomp > puts 'Please tell me your last name now.' > last_name = gets.chomp > var1 = first_name > var2 = middle_initial > var3 = last_name > name = var1.to_s + var2.to_s + var3.to_s > puts 'Pleased to meet you, ' + name + '!' You picked a good starter language to learn! No need to create those extra vars: name = "#{first_name} #{middle_initial} #{last_name}" Note the spaces put in between the values. Cheers