Hot Posts

For loops and if-then-else conditions without braces

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: