lundi 9 février 2015

Toggle Boolean Values in Multidimensional Array

I am trying to get this method to be able to toggle between false and true for my 2 dimensional boolean array. Each value in the array corresponds to a square, but I need to toggle between the two whenever a certain square with coordinates row and column is pushed within the window. However, it is giving me an error for invalid operator == so I am not sure how else to go about this. Any help would be appreciated.



public void clickSquare( int row, int column )
{

if (grid[row][column] == false)
{
grid[row][column] == true;
}
else
{
grid[row][column] == false;
}
return;
}

Aucun commentaire:

Enregistrer un commentaire