John W Kennedy wrote:
> David Spitzer wrote:
>> puts 'Hello what is you\'re Favorite Number?'
> 
> Well, there's your /first/ syntax error.
> 
>> puts 'I think ' + (number.to_i + 1) + ' may be a better favorite number
>> though...'
> 
> Since "+" can mean either "concatenate strings" or "add numbers", you
> need a "to_s" there, just as you needed "to_i" before trying arithmetic.
> --
> John W. Kennedy
>   "Though a Rothschild you may be
> In your own capacity,
>      As a Company you've come to utter sorrow--
> But the Liquidators say,
> 'Never mind--you needn't pay,'
>      So you start another company to-morrow!"
>    -- Sir William S. Gilbert.  "Utopia Limited"

Aha it worked!:

puts 'I think ' + (number.to_i + 1).to_s + ' may be a better favorite 
number though...'

thanks!
-- 
Posted via http://www.ruby-forum.com/.