From: "Jesús Gabriel y Galán" Date: 2010-03-25T17:09:10+09:00 Subject: Re: Help a noob. On Thu, Mar 25, 2010 at 7:08 AM, Omar Velez wrote: > Ok,  I have been programming for two days now.  Ruby is my first > language ever. Welcome ! I hope you enjoy it. > But all the books I look for already assume you have a > good deal of knowledge in programming.  Does anyone know where I can get > a good basic start that will give me lots of examples? I've seen people telling good things about Chris Pines' book: http://pine.fm/LearnToProgram/ although I haven't read it. > Also if it is > possible can someone please tell me what I am doing wrong?  This is my > first program so please do not make too much fun of me.  Thanks yall. > > This is my program... > > # Program will ask for a persons personal information and then display > # the results on the screen.  Finally it will ask a person to give their > # favourite number and then add it to their age and suggest a new > # favourite number. Your program looks fine. The only comments are idiomatic stuff: > puts 'What is your first name?' > Fname = gets.chomp In Ruby the convention is to use snake_case. Also names that start with an uppercase letter are constants, so I'd do: first_name = gets.chomp # also, don't be afraid to have longer variable names if they are clearer > puts 'What is your middle name?' > Mname = gets.chomp middle_name = gets.chomp > puts  'What is your last name?' > Lname = gets.chomp last_name = gets.chomp > puts '' puts #no need to pass an empty string > puts 'What is your age?' > Age = gets.chomp age = gets.chomp > puts '' puts > puts 'What is your favourite number?' > Fnum = gets.chomp favourite_number = gets.chomp Also, my preference is to transform strings into integers the earliest possible if the concept is really a number so, I'd do: age = gets.chomp.to_i # or Integer(gets.chomp) for more strict tranformation favourite_number = gets.chomp.to_i > puts ' ' puts > > puts 'This is your information...' > puts 'You are ' +Fname+ ' '  +Mname+ ' ' +Lname+ '.' > puts 'Your age is ' +Age+ '.' > puts 'And your favourite number is ' +Fnum+ '.' String interpolation is preferred to concatenation (less objects to create): puts "This is your information..." puts "You are #{first_name} #{middle_name} #{last_name}." puts "Your age is #{age}." puts "And your favourite number is #{favourite_number}" > C = Fnum.to_i > A = Age.to_i not needed anymore > NFnum = C + A new_favourite_number = favourite_number + age > puts 'Maybe, your favourite number should be ' +NFnum+ '.' puts "Maybe, your favourite number should be #{new_favourite_number}" which by the way removes the problem you were having, since string interpolation calls to_s automatically. Jesus.