Operator: Short-Circuit And
Operator: Short-Circuit And

Operator: Short-Circuit And

Returns the result of the logical "and" between two values. The values are evaluated as though they were boolean values. Resultant value type is always boolean.

The difference between this operator and logical and is that this will stop evaluation of the rest of the expression if this evaluates as false (or is not true-equivalent).

Example

Short-Circuit And Example


world
{
	function trueFunction()
	{
		textln("Calling trueFunction() - returning true.");
		return true;
	}
	
	function falseFunction()
	{
		textln("Calling falseFunction() - returning false.");
		return false;
	}

	start()
	{
		textln("falseFunction() && trueFunction()");
		textln("Result: " + (falseFunction() && trueFunction()));
		textln("trueFunction() && falseFunction()");
		textln("Result: " + (trueFunction() && falseFunction()));
		quit;
	}
	
}
×

Modal Header