Java <identifier> expected error? -
i 20 errors in middle loops when compiling program; following snippet:
public static long[] bishopsmasks() { long[] masks = new long[64]; (int j = 0; j < 8; j++) { (int = 0; < 8; i++) { long x = 0l; (int = + 1, int b = j + 1; < 7 && b < 7; a++, b++) x |= bit(a, b); (int = + 1, int b = j - 1; < 7 && b > 0; a++, b--) x |= bit(a, b); (int = - 1, int b = j + 1; > 0 && b < 7; a--, b++) x |= bit(a, b); (int = - 1, int b = j - 1; > 0 && b > 0; a--, b--) x |= bit(a, b); masks[i + j * 8] = x; } } return masks; }
i can't find wrong it!
you can't declare multiple variables in for-loop initializer this:
for (int = + 1, int b = j + 1; < 7 && b < 7; a++, b++)
you can, however, (note removal of int
before b
):
for (int = + 1, b = j + 1; < 7 && b < 7; a++, b++)
however, means variables have same type, of course.
see java language specification section 14.14.1 more information.
Comments
Post a Comment