I’ve been bitten by this before… maybe
it is a feature, but I’m not sure of the
I wrote a line like this:
num = gets.chomp.to_i rescue max
thinking that a simple carriage return
would assign max to num.
But of course, “”.to_i does not give us
an error; it simply returns zero (as does
"foo".to_i or any other such string).
What is the reason for this? My instinct
is that an exception should result.
I know it’s been discussed before, but I
can’t find it now.