How to get the indexes of an array in Ruby

1 Answer

0 votes
arr = ["ruby", "c++", "go", "php", "java"]
  
arr.each_index do |index|
    puts index
end
 
 
 
# run:
  
# 0
# 1
# 2
# 3
# 4

 



answered Aug 31, 2020 by avibootz

Related questions

...