From: Jaime Gonzalez Date: 2010-05-29T04:18:43+09:00 Subject: Re: A complete beginners question --00c09f971feee5532d0487ac5fa3 Content-Type: text/plain; charset=ISO-8859-1 Hi, just do this: puts "What is your favourite number?" number = gets.chomp number+=1 puts "Do you not think #{number.to_s} is a better number?" Best regards. On Fri, May 28, 2010 at 12:13 PM, J-H Johansen wrote: > On Fri, May 28, 2010 at 8:59 PM, Ant Walliams > wrote: > > Reid Thompson wrote: > >> On Sat, May 29, 2010 at 03:29:15AM +0900, Ant Walliams wrote: > >>> Hi there, > >>> puts 'What is your favourite number?' > >>> number = gets.chomp > >>> number+=1 > >>> puts 'Do you not think' + number + 'is a better number?' > >> puts 'Do you not think' + number.to_s + 'is a better number?' > > > > Thank for the reply but I am still getting the same error even after > > making your changes. Any ideas? > > > > Thanks > > Ant > > -- > > Posted via http://www.ruby-forum.com/. > > > > > > You need to convert the input from String to Fixnum > > puts "What is your favourite number?" > number = gets.chomp.to_i > number+=1 > puts "Do you not think #{number} is a better number?" > > > -- > Jens-Harald Johansen > -- > There are 10 kinds of people in the world: Those who understand binary and > those who don't... > > -- Jaime Gonzalez. --00c09f971feee5532d0487ac5fa3--