Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #4201

Re: Enumerable#find returns an enumerator?

From 7stud -- <bbxx789_05ss@yahoo.com>
Newsgroups comp.lang.ruby
Subject Re: Enumerable#find returns an enumerator?
Date 2011-05-10 15:39 -0500
Organization Service de news de lacave.net
Message-ID <7077211fb8bc80744838cb61794cef86@ruby-forum.com> (permalink)
References <6cc262653e3f003816a98ce87fb22fdf@ruby-forum.com>

Show all headers | View raw


Roger Pack wrote in post #997818:
> Hello all.
> I would have expected that
>
> [1,2,3].find(3)
>
> just return me the element 3, not an enumerator,

Where in the world did you dream up that?  Enumerable#find() returns the 
first element for which the block is true.  Where is your block?  The 
argument to find() is the default value you want find() to return if the 
block is false for all elements.

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Enumerable#find returns an enumerator? Roger Pack <rogerpack2005@gmail.com> - 2011-05-10 13:48 -0500
  Re: Enumerable#find returns an enumerator? Chris Hulan <chris.hulan@gmail.com> - 2011-05-10 11:56 -0700
  Re: Enumerable#find returns an enumerator? Jeremy Bopp <jeremy@bopp.net> - 2011-05-10 14:12 -0500
  Re: Enumerable#find returns an enumerator? Lars Schirrmeister <l.schirrmeister@gmx.de> - 2011-05-10 15:33 -0500
    Re: Enumerable#find returns an enumerator? Robert Klemme <shortcutter@googlemail.com> - 2011-05-10 23:23 +0200
      Re: Enumerable#find returns an enumerator? Brian Candler <b.candler@pobox.com> - 2011-05-11 03:43 -0500
        Re: Enumerable#find returns an enumerator? Robert Klemme <shortcutter@googlemail.com> - 2011-05-11 05:54 -0500
          Re: Enumerable#find returns an enumerator? Brian Candler <b.candler@pobox.com> - 2011-05-11 07:47 -0500
            Re: Enumerable#find returns an enumerator? Robert Klemme <shortcutter@googlemail.com> - 2011-05-11 19:13 +0200
            Re: Enumerable#find returns an enumerator? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-11 15:08 -0500
              Re: Enumerable#find returns an enumerator? Brian Candler <b.candler@pobox.com> - 2011-05-13 03:20 -0500
  Re: Enumerable#find returns an enumerator? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-10 15:39 -0500
    Re: Enumerable#find returns an enumerator? Ryan Davis <ryand-ruby@zenspider.com> - 2011-05-10 18:13 -0500

csiph-web