Skip to content
Advertisement

Python’s enumerate in Ruby?

JavaScript

Is something built in for this? It doesn’t need to have it’s members immutable, it just needs to be in the standard library. I don’t want to be the guy who subclasses the Array class to add a Python feature to a project.

Does it have a different name in Ruby?

JavaScript

Advertisement

Answer

Something like this in Python:

JavaScript

becomes this in Ruby:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement