Assertions

An assertion is a way of checking what you think should be true at a program point is true at that point. The syntax for an assertion comes in two forms (with and without a message):

	assert boolean_condtion;
	
	assert boolean_condition : string_message_to_print;

Assertions can, for example, be used to check pre-conditions during development of code, e.g:

Example 1.7. Assertion Example

	void main(){
		printNumber(3);
		printNumber(8);
		printNumber(-1);
	}
	
	
	void printNumber(int a){
		assert ( a >= 0 && a <= 10 ) : "Invalid argument";
		
		println(a);
	}