Robert Klemme wrote: > "Tod McIntyre" <todmcintyre / gmail.com> wrote in message > news:da9c35364b80a5c4e9e603e0db41190a / ruby-forum.com... >> arr=[4,1,3,7] >> arr.find { |f| f==someval } >> will return the val within arr that matches someval, which doesn't >> really help me because I already have someval > > Yeah, but this is just a special case. With a block you can employ > arbitrary selection criteria - not just ==. > >> How do I actually return the index in arr to the first match of someval. >> >> so if someval == 3, my block would return 2, for the above example > > As Ross and Daniel have pointed out already, use #index. > > Kind regards > > robert Once again I knew this would be a simple answer!! I thank you for your quick responses. Obviously I should be reading the api more thoroughly before posting. -- Posted via http://www.ruby-forum.com/.