On May 28, 2010, at 2: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 the problem is with number+=1 number is a string because gets.chomp is a string number+=1 is syntactic sugar for number = number + 1 And the expression number + 1 is trying to add 1 (a Fixnum) to a string Try changing: number = gets.chomp.to_i to convert the string into an integer (which if small enough will be held in an instance of Fixnum). Then, you'll have the opposite problem with the last line unless you incorporate Reid's suggestion. -Rob Rob Biedenharn http://agileconsultingllc.com Rob / AgileConsultingLLC.com