Lorenzo E. Danielsson wrote:
> Integer(gets), works well if you enter any integer apart from 0, which
> complains about "0\n" not being a valid integer. As expected,
> Integer(gets.chomp) works for all integers, including 0.

For me (Windows2000) it works well for Ruby 1.8.6, but not for nightly 
snapshot of Ruby 1.9...

>type putsgets.rb
puts Integer(gets)
puts Integer(gets)
>ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]

>ruby putsgets.rb
5
5
0
0

>ruby19 -v
ruby 1.9.0 (2007-12-02 patchlevel 0) [i386-mingw32]

>ruby19 putsgets.rb
5
5
0
putsgets.rb:2:in `Integer': invalid value for Integer: "0\n" 
(ArgumentError)
        from putsgets.rb:2:in `<main>'

I'll post this in ruby-core because it looks strange.
-- 
Posted via http://www.ruby-forum.com/.