Monday, August 07, 2006

Learning to Program -- Code Sample

Here's the Ruby code for the second exercise in "Mixing it Up" chapter of Chris Pine's Learn to Program

puts '=====Your favorite number======='
puts 'What\'s your favorite number?'
fnum=gets.chomp
puts 'Have you considered changing your favoriate number to '+x=(fnum.to_i+1).to_s
puts 'Why not choose the number '+x+' which is not only bigger but also better!'

No comments: