Loops with arrays of arbitrary dimensions

Assuming this is what you want to do, you would write it like this:

for I in CartesianIndices(A)
    i1 = I[1]
    x[i1] = 2 * A[I]
end
4 Likes