From: John Barnette Date: 2009-07-17T12:39:39+09:00 Subject: Re: Need Help with a Very, Very Simple Program Hi, On Thu, Jul 16, 2009 at 4:53 PM, Max Norman wrote: > I'm almost an absolute novice in Ruby; it is my first language and I > just began learning the basics yesterday, using Chris Pine's 'Learning > to Program.' Welcome! > The trouble I'm having is simple, but nonetheless I would appreciate an > explanation. The little program I've written accomplishes a simple task: > it asks for your favorite number, adds one to it, then returns it to > you. Here it is: > > puts 'Hey there, I\'m Uno.' > puts 'What\'s your favorite number?' > number = gets.chomp > better = number.to_i + 1 > puts better + '...That\'s better.' Looks like a few other folks have already solved your problem, so a quick note on Ruby idiom/features. Ruby lets you use single *or* double quotes to represent a string. The difference is that double quotes allow variables to easily be inserted in your string. Also, they make it easy to have apostrophes in your strings! A slightly modified example, with no more \' pain: puts "Hey there, I'm Uno." puts "What's your favorite number? number = gets.chomp better = number.to_i + 1 puts "#{better}... That's better." ~ j.