From: Mike Peltzer Date: 2010-03-09T09:11:32+09:00 Subject: convert s to i, then + 1 Hi all, I am very to new to ruby and am having trouble writing a very simple program: basically i just want to ask for an integer then return the integer +1 here is my code: --------------------------------------------------- puts 'what\'s your favorite number?' var1 = 1 num = gets.chomp puts 'well ' + num.to_i + ' + var1 is better' ------------------------ when I run it, this is the error i get: --------------------------------------- what's your favorite number? 3 ri20min.rb:5:in `+': can't convert Fixnum into String (TypeError) from ri20min.rb:5:in `
' --------------------------------------- I realize this is laughable, but I am struggling with the concept, any help is greatly appreciated. -- Posted via http://www.ruby-forum.com/.