Operators: &&

AND operator.

Syntax

bool‑operand&&bool‑operand

rect‑operand&&rect‑operand

Logical AND

In its first version, the && operator performs on the both boolean operands a logical AND operation. The operation results in the value true only when both operands are true. The resulting data type of the operation is always bool. For example:

var bool  a = true;
var bool  b = false;
var bool  c = true;

var bool  result = a && b;  // result = false
var bool  result = a && c;  // result = true

Advanced rectangle intersection

In its second version, the && operator performs a rectangle intersection. The result is a new rectangle representing an area contained within the left AND the right rect operand. The operator results in an empty rectangle (isempty) if the both rectangles don't intersect. Please note, unlike the operator &, this version of the rectangle intersection ignores empty rectangles. If one of the rectangles is empty, the operator returns immediately the counterpart operand without performing any intersection calculation. For example:

var rect a = <10,5,110,220>;
var rect b = <-10,-50,50,75>;
var rect c = <110,5,120,220>;
var rect d = <0,0,0,0>;

var rect result = a && b; // result = <10,5,50,75>
var rect result = b && a; // result = <10,5,50,75>
var rect result = a && c; // result = empty rectangle
var rect result = a && d; // result = <10,5,110,220>