Unusual loop/conditional constructions that ARE valid.
if (j == 1) break;
if (j == 1) break foreach;
if (true);
if (true); else if (false); else;
for (int x = 0; x<5; x++)
System.out.println(x);
for (int x = 0; x<5; x++)
System.out.println(x);
NOTE: the space between the two lines does not cause an error.
for (int x = 0; x<5; x++)
// comments here
System.out.println(x);
for (int x = 0; x<5; x++)
for (int y = 0; y<5; y++)
for (int z = 0; z<5; z++)
System.out.println(x);
Leave a comment