From: Karthikeyan A K Date: 2010-06-01T10:10:15+09:00 Subject: Re: A complete beginners question --=-8GoHZ+rzGu6ZqDE2sWfd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit puts 'What is your favourite number?' number = gets.chomp number = number.to_i # converts the number from String to Integer number+=1 puts 'Do you not think' + number + 'is a better number?' On Sat, 2010-05-29 at 03:29 +0900, Ant Walliams wrote: > Hi there, > > Sorry this is probably going to be a real easy question but I am totally > new to programming. > > I was following some tutorial online and at the end of the first chapter > it said 'Now create a program that asks the user for a number and then > suggests a higher number as a better option. > > So what I wanted to happen below is it takes the users input and just > adds 1 to it. But is is coming back with "rb:3:in '+' can't convert > fixnum into string' > > puts 'What is your favourite number?' > number = gets.chomp > number+=1 > puts 'Do you not think' + number + 'is a better number?' > > Any help would be appreciated its doing my head in. > > Thanks Regards A.K.Karthikeyan, Prop. Mind As Lab http://mindaslab.in --=-8GoHZ+rzGu6ZqDE2sWfd--