I'm using an .each loop to iterate over an array. I want to change elements in this array, so I tried something like this:
ex = ["el01", "el02", "el03", "el04"]
ex.each do |el|
if (el == "el02")
el = "changed"
end
end
puts ex
but it seems don't works! It puts me :
el01
el02
el03
el04
I want to know what I did wrong! or if it can't be done this way, how to do it.
.mapthat I didn't know before, can you please vote-it up ? I can no longer ask questions in stackoverflow because of this question.