Operators: |

OR operator.

Syntax

integer‑operand|integer‑operand

rect‑operand|rect‑operand

Bitwise OR

In its first version, the | operator performs on the both operands a bitwise OR operation. If used with two signed integer operands, the resulting data type is always int32. In all other cases, the operation results in the unsigned uint32 value. For example:

var uint32 a = 0xFF003AC0; var uint32 b = 0xAB15FF70; var int32 c = 1369; // = 0x00000559 var int32 d = -1496; // = 0xFFFFFA28 var uint32 result = a | b; // result = 0xFF15FFF0 var int32 result = c | d; // result = -135 var uint32 result = a | d; // result = 0xFFFFFAE8

Rectangle union

In its second version, the | operator determines the union of two rectangles. The result is a new rectangle representing an area where both the left and the right rect operands are completely included. If one of the rectangles is empty, the operator returns immediately the counterpart operand without performing any calculations. 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,-50,110,220> var rect result = b | a; // result = <-10,-50,110,220> var rect result = a | c; // result = <10,5,120,220> var rect result = a | d; // result = <10,5,110,220>