ruby find index of element in array
# Given array
arr = [10, 20, 30, 40, 50]
# Element to find index for
element_to_find = 30
# Using the `index` method to find the index of the element
index_of_element = arr.index(element_to_find)
# Displaying the result
puts "Index of #{element_to_find} in the array is: #{index_of_element}"