i have the following array:
int[,] simpleArray =new int[,]{
{1,1},{1,2},{1,3},{1,4},{1,5},{1,6},{1,7},{1,8},{1,9},{1,10},{1,11} ,
{2,1}, {2,11},
{3,1}, {3,11},
{4,1}, {4,11},
{5,1}, {5,11},
{6,1}, {6,11},
{7,1}, {7,11},
{8,1}, {8,11},
{9,1}, {9,11},
{10,1}, {10,11},
{11,1},{11,2},{11,3},{11,4},{11,5},{11,6},{11,7},{11,8},{11,9},{11,10},{11,11},
};
for (int i = 0; i < 11; i++)
{
for (int m = 0; m < 11; m++)
{
if (simpleArray[i, m] == simpleArray[1, 1])
{
string one = "";
string two = "";
string three = "Go To Jail";
string four = "";
string five = "";
Console.WriteLine(one);
Console.WriteLine(two);
Console.WriteLine(three);
Console.WriteLine(four);
Console.WriteLine(five);
Console.WriteLine(i);
Console.WriteLine(m);
}
if (simpleArray[i, m] == simpleArray[1, 2]) // array index out of bound!!? why?
{
string one = "";
string two = "";
string three = "Go To Jail";
string four = "";
string five = "";
Console.WriteLine(one);
Console.WriteLine(two);
Console.WriteLine(three);
Console.WriteLine(four);
Console.WriteLine(five);
}
i try to create a monopoly board. it gives me array index out of bound on the second if. why?