Ad
  • Default User Avatar

    I'd recommend going through the methods of Enumerable (see http://ruby-doc.org/core-2.3.1/Enumerable.html) and practicing usage of each one so you can get familiar with them - most of these methods are very useful in the real world and for code kata!

  • Default User Avatar

    It shouldn't!

    [1] pry(main)> def test_even(n)
    [1] pry(main)*   n % 2 == 0
    [1] pry(main)* end
    => :test_even
    [2] pry(main)> test_even(2.0)
    => true
    [3] pry(main)> 2.0 % 2
    => 0.0
    [4] pry(main)> 0.0 == 0
    => true
    

    Maybe you're thinking of .eql?:

    [5] pry(main)> 0.0.eql? 0
    => false
    

    Edit: just observed that floats should be considered uneven for this, so I eat my words! Has the kata changed since it was originally written?