I want to replace all occurrences of 2 with 3.I want to do this without using the value of the index because that would be hardcoding. What I have so far is:
list=[1,2,3,4,2,34,2]
replace_at(list, index, value)
Enum.each list, fn(x) ->
if x==2 do
replace_at(list, index, 3)
end
Enum.each list, fn(x) ->
IO.puts x
end