Sha256: 310fbc1651b90cdcd5a68a7d54dfe2050bc083e85358435b4258ab25c6c7986a
Contents?: true
Size: 563 Bytes
Versions: 3
Compression:
Stored size: 563 Bytes
Contents
unless (RUBY_VERSION[0,3] == '1.9') class Integer # Returns true if this integer is odd, false otherwise. # # 2.odd? #=> false # 3.odd? #=> true # # -99.odd? # -> true # -98.odd? # -> false # # CREDIT: Gavin Sinclair def odd? self % 2 == 1 end # Returns true if this integer is even, false otherwise. # # 2.even? #=> true # 3.even? #=> false # # CREDIT: Gavin Sinclair def even? self % 2 == 0 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-2.4.2 | lib/core/facets/integer/odd.rb |
facets-2.4.3 | lib/core/facets/integer/odd.rb |
facets-2.4.4 | lib/core/facets/integer/odd.rb |