For loop inside an if condition statement

With your modified code it would rather be

flag = all(A[i] == B[C[i], i] for i in 1:n)

but you know better what you really want.

3 Likes