lasitha wrote:
> On Fri, Apr 24, 2009 at 9:38 AM, Rob Redmon <rob.webinator / gmail.com> 
> wrote:
>> How do I get the matched indices? ?That is, without ugly loops.
> #index and #rindex in their block forms come to mind:
> http://ruby-doc.org/core-1.9/classes/Array.html#M001974
> 
> cheers,
> lasitha

In the URL, they specified the following:
     a.rindex{|x|x=="b"}

But the rindex method doesn't provide the syntax of passing the blocks. 
I had
tried the following and it thrown the error.

irb(main):012:0> a=[10,20,30,40,50]
=> [10, 20, 30, 40, 50]
irb(main):013:0> a.rindex{|x| x>20}
ArgumentError: wrong number of arguments (0 for 1)
        from (irb):13:in `rindex'
        from (irb):13
        from (null):0
-- 
Posted via http://www.ruby-forum.com/.