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_f
nil.to_f → 0.0
object.c
View on GitHub ↗
static VALUE
nil_to_f(VALUE obj)
{
return DBL2NUM(0.0);
}
Always returns zero.
Example
nil.to_f #=> 0.0