Priority 8 operators

&x & yLogical AND operator

It is binary logical AND operator and has left-associativity.


Table of contents:


Logical AND operator

Logical AND operator

Logical AND operator performs logical AND operation on operands. Operands must be the bool class.

The result is the bool class.


bool result = true & true; // The result is true;

result = true & false; // The result is false;

result = false & true; // The result is false;

result = false & false; // The result is false;

Operand evaluation is not short-circuit evaluation. Both operands are always evaluated.


If operands return the proxy class, the entity of the proxy is automatically used. The result is the same as calling the Entity getter of the proxy class.


bool b = true;

bool b2 = false;

proxy pro = new proxy(b);

proxy pro2 = new proxy(b2);

bool b3 = pro2 & pro; // b3 is false.

Copyright © Rice All rights reserved.