Last Updated: February 25, 2016
·
342
· mejarc

Altering array elements in place

Iterate using .map!, .collect!, if the index isn't something of interest:

[1, 2, 3, 4].map! do |element|
  element * 2
end