For Loop Array Index Out of Range

It’s just a simple for loop, but I keep getting the error that: “IndexOutOfRangeException: Array index is out of range.” I can’t figure out how it’s going out of range. Just trying to fill a 2D Array with zeros:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class pedalBuilder : MonoBehaviour {

int[,] ModuleNumber = new int [12,21];

	void Start () {

		for(int row = 0; row < 13; row++) {
			for (int column = 0; column < 22; column++) {
		Debug.Log(row + " , " + column);
		ModuleNumber [row,column] = 0;
			}
		}
	}	
}

Remember that in your array, when you set the length of 21, is 20 because the count start from 0 not from 1.

In the for loop row you can set 12, and in the column set 21. but is not ok to use magic numbers
Instead use the Length property in single dimensional array or GetLength() in multi-dimensional array passing the dimension.

for(int row = 0; row < ModuleNumber.GetLength(0); row++) 
{
    for (int column = 0; column < ModuleNumber.GetLength(1); column++)
    {
        Debug.Log(row + " , " + column);
         ModuleNumber [row,column] = 0;
    }
}