Java assert?

I just found out today that java has built in assertions.


	public void triggerAssert() {
		int number = 100;
		assert number != 100;
	}

Though you need to specify some flags to VM for them to work, which I haven’t figured out yet :smiley:

Would be really cool if anyone knows how to make this work in Libgdx.

[icode]-ea[/icode] (enable assertions)

Yes, I saw that on stackoverflow, but where do I put that if I’m using Libgdx?

In Android studio you can change Run/Debug configurations and add VM options. Put the [icode]-ea[/icode] there and it will work after that even in LibGDX.

I’m not sure what steps you will have to make in other IDE’s but it should be pretty much the same. Somewhere you can add/modify VM options and adding the flag there will make the asserts enabled.