General Predicates
puts 0.zero? # => true (is this number zero?) puts 1.0.zero? # => false puts 0.0.nonzero? # => nil (works like false) puts 1.nonzero? # => 1 (works like true) puts 1.integer? # => true puts 1.0.integer? # => false puts 1.scalar? # => false: not a complex number. Ruby 1.9. puts 1.0.scalar? # => false: not a complex number. Ruby 1.9.