Boolean operators on ints
width and height are int values that indicate the size of the array (9 x 9) in this case.
i and j are the two indexs of the 2D array. What I am trying to do is figure out if point [i][j] is on the edge of the array.
That is, I want to check that:
(i is equal to 0 or width-1) and (j is equal to 0 or height-1)
Code:
private boolean isExit(int i, int j)
{
if (((i = 0) || (i = width - 1))||((j = 0) || (j = height - 1))) return true;
return false;
}
However it says the or operator "||" can't be applied to int, int.
This line, same except with </> instead of = works fine though:
Code:
if (((i < 0) || (i > width - 1))||((j < 0) || (j > height - 1))) return false;
Help!
Thanks
DOH only typed one equals in code. Derp.
Sorry!