reprahkcin
2/13/2019 - 8:35 PM

Two-dimensional Array

The setup of a two-dimensional array, with a for loop to populate it with random numbers. Also prints one of the entries to the console.

    public static int Row = 6;
    public static int Column = 5;

    private int[,] numbers = new int[Row, Column];

    void Start()
    {
        for (int row = 0; row < Row; row++)
        {
            for (int column = 0; column < Column; column++)
            {
                numbers[row, column] = Random.Range(10, 50);
            }
        }

        Debug.Log(numbers[1, 2]);
    }