iterate through a 2d array code example
Example 1: how to use loop in 2d array
for (int row = 0; row < board.length; row++) {
for (int col = 0; col < board[row].length; col++) {
board[row][col] = row * col;
}
}
Example 2: iterating over 2d array python
x = [ ['0,0', '0,1'], ['1,0', '1,1'], ['2,0', '2,1'] ]
for i in range(len(x)):
for j in range(len(x[i])):
print(x[i][j])