From: Wes Bailey Date: 2010-06-01T15:05:15+09:00 Subject: Re: A complete beginners question ----- "Josh Cheek" wrote: > On Mon, May 31, 2010 at 10:53 PM, Guten wrote: > > > The final solution is look like this: > > > > puts 'What is your favourite number?' > > number = gets.chomp.to_i > > number +=1 > > puts 'Do you not think #{number} is a better number?' > > > > You don't need chomp. > > "1\n".to_i # => 1 > "1".to_i # => 1 Let's not forget our double quotes. Also why write so much code? puts 'What is your favorite number?' puts "Bah! #{gets.to_i + 1} is a better number!" Understand the #{...} is implicitly invoking to_s on the result so it can be displayed as part of the final string.