VOOZH about

URL: https://www.geeksforgeeks.org/ruby/ruby-array-class-find_index-operation/

⇱ Ruby | Array class find_index() operation - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Array class find_index() operation

Last Updated : 8 Jan, 2020
Array#find_index() : find_index() is a Array class method which returns the index of the first array. If a block is given instead of an argument, returns the index of the first object for which the block returns true.
Syntax:  Array.find_index()

Parameter: block - condition to follow

Return:  index value of the array elements
Code #1 : Example for find_index() method Output :
find_index : 4

find_index : 1

find_index : 2
Code #2 : Example for find_index() method Output :
find_index : 0

find_index : 1

find_index : 1
Comment
Article Tags: