No loop, do break

axReading the standard of the Java language I found something interesting. Something that implies that break can be used without a loop, and not only inside a loop but inside any block. And it does:

package wierdo;

public class Wierdo {
	public static void main(String[] args) {
		label: {
			if (args.length == 0)
				break label;
			System.out.println("We happy, we have arguments!");
		}
		System.out.println("Hello Wierldo!");
	}
}

Weird, is it? You can read some more on this.

Practical consequences? If you are an architect and you work with subordinates: keep an axe by your side to chop off hands writing those in prod code. If you are coders: mind the architect approaching with the axe. (Just kidding…)

Advertisements

One thought on “No loop, do break

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