Say that I have 4x4 multidimensional array A:
A = collect(reshape(1:16, 4, 4))
4×4 Array{Int64,2}:
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16
and I want to iterate row by row (i.e. [1, 5, 9, 13] first, then [2, 6, 10, 14], then ...).
How do I do it? For now I have come up with the following:
`for row in 1:size(A, 1)
println(A[row, :])
# do something
end`
but I was wondering if there was a more "pythonic" way of doing it: kind of for line in A: for element in line: ....
I also know about CartesianRange, but I would like to have an array-like row to work with at each iteration.