I currently have 2 bool arrays in a class file as defined by
public static bool[] bArray;
public static bool[] randomRemove;
And I fill bArray like this
public static void fillArray()
{
for (int x = 0; x < 54; x++)
{
bArray[x] = false;
}
}
And I fill randomRemove like this
for (int i = 0; i < sizeOfArray; i++)
{
randomRemove[i] = false;
}
Where sizeOfArray is the length of string array that I use.
I have two warnings for each bool array that says they are never assigned to and will always have its default value of null but I clearly have code that assigns them. Whenever I try to click a button that utilizes the arrays I get a run time error. Is there any reason this is happening?
You need to call
somewhere in your code before you use them. Also, bool arrays default to all falses.