Ok, I changed the code a bit to try your answer:
print "First number: "
a = Integer gets.strip
print "Second number: "
b = gets.to_i
and I could totally get what you said ( I think :D ). The .to_i method
accepts and string while "Integer gets.strip" restricts the input data
to an integer and by the way strips any blank space, throwing an
ArgumentError if the input is uncompatible.
The other issue I had with STDOUT.flush was more related with Scite
console than with code itself. There's no need to use it in this little
program, at least. But I kinda got lost with this:
" > $stdout.flush # if necessary and some of us prefer the global
variable
> to the constant, but I forgot why, LOL"
You mean creating a global variable at the beginning of the program, or
am I missing something?
--
Posted via http://www.ruby-forum.com/.