From: Joel Pearson Date: 2013-02-15T17:44:14+09:00 Subject: Re: skip iteration in each loop I doubt this is the best method, but here's one way to do it irb(main):001:0> persons = [1,2,3,4,5,6,7,8] => [1, 2, 3, 4, 5, 6, 7, 8] irb(main):002:0> skip_next = 0 => 0 irb(main):003:0> persons.each do |x| irb(main):004:1* if x == 2 irb(main):005:2> skip_next = 2 irb(main):006:2> elsif skip_next > 0 irb(main):007:2> skip_next -= 1 irb(main):008:2> next irb(main):009:2> end irb(main):010:1> p x irb(main):011:1> end 1 2 5 6 7 8 -- Posted via http://www.ruby-forum.com/.