User input is a string. Convert it to a number first. If it is supposed
to be an integer, use gets.chomp.to_i, if it can be a decimal number,
use gets.chomp.to_f. Then you cann add 1 with favnumber+1.
If you’re going to build the end string like that, you’ll also need to
convert the number back into a string.
For example:
‘… think ’ + number.to_s + ’ is …’
User input is a string. Convert it to a number first. If it is supposed
to be an integer, use gets.chomp.to_i, if it can be a decimal number,
use gets.chomp.to_f. Then you cann add 1 with favnumber+1.
If you’re going to build the end string like that, you’ll also need to
convert the number back into a string.
For example:
‘… think ’ + number.to_s + ’ is …’
Thanks Joel, I am working with it now. Ill update you guys as soon as I
get it.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.