Change for i=1:length(A)
to for i in eachindex(A)
#10858
Merged
for i=1:length(A)
to for i in eachindex(A)
#10858