eachMapping
.eachMapping() { |index, element| ... }
Iterates over each item is array, and yields the index and element into the attached block. This is done in order.
ns = [ 1, 2, 3, 4 ]
// doubles every other number
ns.eachMapping() do |i, number|
if i % 2 == 1
ns[i] = number*2
end
endSee Also
A link which will reset your password has been sent to your email address.
This link will be active for up to 24 hours.