D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Array
/
Filename :
index-i.ri
back
Copy
U:RDoc::AnyMethod[iI" index:ETI"Array#index;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"KReturns the zero-based integer index of a specified element, or +nil+.;To:RDoc::Markup::BlankLine o; ; [I"(With only argument +object+ given, ;TI"6returns the index of the first element +element+ ;TI"*for which <tt>object == element</tt>:;T@o:RDoc::Markup::Verbatim; [I"!a = [:foo, 'bar', 2, 'bar'] ;TI"a.index('bar') # => 1 ;T:@format0o; ; [I",Returns +nil+ if no such element found.;T@o; ; [I"With only a block given, ;TI"3calls the block with each successive element; ;TI"Wreturns the index of the first element for which the block returns a truthy value:;T@o;; [I"!a = [:foo, 'bar', 2, 'bar'] ;TI"2a.index {|element| element == 'bar' } # => 1 ;T; 0o; ; [I"=Returns +nil+ if the block never returns a truthy value.;T@o; ; [I"JWith neither an argument nor a block given, returns a new Enumerator.;T@o; ; [I"NRelated: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].;T: @fileI"array.c;T:0@omit_headings_from_table_of_contents_below000[ I"(*args);T@-FI" Array;TcRDoc::NormalClass0[@0FI"find_index;T