method
index
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
index(*args)
public
Returns the index of the first object in ary such that the object is
to obj.
If a block is given instead of an argument, returns the index of the first object for which the block returns true. Returns nil if no match is found.
See also Array#rindex.
An Enumerator is returned if neither a block nor argument is given.
a = [ "a", "b", "c" ] a.index("b") #=> 1 a.index("z") #=> nil a.index { |x| x == "b" } #=> 1
Register or
log in
to add new notes.
Mange -
July 8, 2009
![Default_avatar_30](https://www.gravatar.com/avatar/1b2792536d87aa21bc739c14980fa103?size=30&default=http://apidock.com/images/default_avatar_30.png)
1 thank
This is an alias
Please comment under the real method instead: find_index