The Numeric#zero? method returns true if the number is 0 and false if it is not. The Numeric#nonzero? method returns nil if the number is 0 and the number itself if it is not.
"The Numeric#zero? method returns true if the number is 0 and false if it is not. The Numeric#nonzero? method returns nil if the number is 0 and the number itself if it is not."
Inconsistent maybe, but of no consequence when used in conditionals (where nil evaluates to false).
Comments
onno.solin.eu replied ago:
"The Numeric#zero? method returns true if the number is 0 and false if it is not. The Numeric#nonzero? method returns nil if the number is 0 and the number itself if it is not."
Inconsistent maybe, but of no consequence when used in conditionals (where nil evaluates to false).
rubayeet replied ago:
Waste of good two minutes.
Voters For This Link (8)
Voters Against This Link (9)