Ruby - Enumerable - each_with_index

  • + 1 comment

    I had tested with drop and it become nice! Thanks!

    • + 2 comments

      can you share code using drop method

      • + 0 comments
        def skip_animals(animals, skip)
             animals.drop_while {|a| animals.index(a) < skip }.map.with_index{|a, index| "#{index}:#{a}"}
        end
        
      • + 0 comments

        animals.drop(skip).map.with_index { |animal, index| "#{index+skip}:#{animal}"}