in Ruby it\'s easy to tell loop to go to next item
(1..10).each do |a| next if a.even? puts a end
result =>
1 3 5
Enumerator#next and Enumerator#peek will be good option to goo :
def my_complex_method(e) return if e.peek.even? p e.peek end enum = (1..5).each enum.size.times do |a| my_complex_method(enum) enum.next end
Output