From: Mando Escamilla Date: 2006-02-28T12:42:23+09:00 Subject: Re: Pine's book "Learning to Program" - Answer? ------=_Part_10556_11407558.1141098129051 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline You're close. better is a fixnum (like the error says). In order to add it to the string= , you'll need to convert it to a string. Luckily, ruby gives you a nice and easy way to do it: better.to_s will return the string version of better. So, this makes the last line: puts ' This is better: ' + better.to_s + '.' Give that a shot. -- Mando On 2/27/06, woodyee wrote: > > Hi! I'm stuck on Chapter 5, 5.4: > > "Write a program which asks for a person's favorite number. Have your > program add one to the number, then suggest the result as a bigger and > better favorite number. (Do be tactful about it, though.)". > > Any ideas? I'm getting "can't convert fixnum into string" errors. > Here's one of the many things I've tried, er, failed: > > puts 'What is your favorite number ?' > num =3D gets.chomp > better =3D 'num'.to_i + 1 > puts 'This is better: ' + better + '.' > > 3rd line's getting me. Can't figure out how to add 1 to the response. > Hopefully, I'll figure this out but any tips are welcomed. Thanks! > > > ------=_Part_10556_11407558.1141098129051--