"each_with_index" loop

Control flow / Loops

nums = [1, 2, 3, 4, 5]
nums.each_with_index{|i, v| 
    puts "nums[#{i}] = #{v}"
}