EARLY OUT OPERATORS (Logical AND and OR)

The logical AND and OR operators (&& and || respectively) are early out operators. That is, evaluation of the expression is aborted as soon as the result is known.

For the && it is possible to abort the evaluation of the right hand side (RHS) of the expression if the left hand side (LHS) of the expression evaluates to FALSE. This is because it is impossible for the RHS to cause the expression to be TRUE if the LHS is FALSE.

e.g.
	A == B  &&  G == H

	if A != B then the result is FALSE regardless of
	the sub-expression G == H
example generated code

For the || it is possible to abort the evaluation of the right hand side (RHS) of the expression if the left hand side (LHS) of the expression evaluates to TRUE. This is because it is impossible for the RHS to cause the expression to be FALSE if the LHS is TRUE.

e.g.
	A == B  ||  G == H

	if A == B then the result is TRUE regardless of
	the sub-expression G == H
example generated code