From: Louis J Scoras Date: 2007-02-21T07:01:58+09:00 Subject: Re: exit a block On 2/20/07, Jim Bob wrote: > > Thanks for your help, sometimes best just to program an old fashion for > loop ;) Nahh, more abstraction is a good thing =) require 'enumerator' class Array def find_my_index(x,y) to_enum(:each_with_index).each_cons(2) {|(a,i),(b,_)| return i if a == x && b == y } nil end end And then it's just: ary = [43,21,56,12,93,12] puts ary.find_my_index(12,93) # => 3 puts ary.find_my_index(93,12) # => 4 puts ary.find_my_index(56,100) # => nil -- Lou.