You’re probably familiar with iterating through an array or hash: Normally, you’d iterate through it with something like this:
Which would generate this output:
Tekfly Yabox Vinder Skiptube Fivespan
each_with_index comes in.
each_with_index, put in a second argument for the index and you’re good to go!
This creates output like this:
Tekfly has index 0 Yabox has index 1 Vinder has index 2 Skiptube has index 3 Fivespan has index 4
For more information on
each_with_index, check out the RubyDoc