+ 2
[Solved] Enumerate() in Ruby
In Python I can easily use enumerate() to do stuff like this: https://code.sololearn.com/c3jb0lHqRGwW/?ref=app Is it possible to do the same in Ruby?
2 Respuestas
+ 5
With help of stackoverflow I came to this solution:
a = [8, 17, 29, 42]
a.each_with_index do |s,i|
puts "#{i} #{s}"
end
source: https://stackoverflow.com/questions/13936922/pythons-enumerate-in-ruby
+ 3
Diego Thank you :)