End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
NilClass#to_i
nil.to_i → 0
object.c
View on GitHub ↗
static VALUE
nil_to_i(VALUE obj)
{
return INT2FIX(0);
}
Always returns zero.
Example
nil.to_i #=> 0