DOCUMENTATION

Operators

DOCUMENTATION

XCX 4.4.1 Operators

Arithmetic Operators

OperatorDescriptionExampleResult
+Addition10 + 313
-Subtraction / Unary Negation10 - 37
*Multiplication10 * 330
/Division (truncates for i)10 / 33
%Modulo (Remainder)10 % 31
^Exponentiation2 ^ 101024
++Integer Digit Concatenation48 ++ 774877

String Operators

OperatorDescriptionExampleResult
+Concatenation"Hi " + "User""Hi User"
HASSubstring search"Search" HAS "ear"true

TIP:

String concatenation automatically converts numbers and booleans to strings (e.g., "Value: " + 42 → "Value: 42").

Logical Operators

OperatorAliasDescription
AND&&Logical AND
OR``Logical OR
NOT!!Logical NOT

Comparison Operators

Used for comparing values of the same type.

OperatorDescription
==Equal to
!=Not equal to
<Less than
>Greater than
<=Less than or equal to
>=Greater than or equal to

Set Operators

WordSymbolDescription
UNION∪Set Union
INTERSECTION∩Set Intersection
DIFFERENCE\Set Difference
SYMMETRIC_DIFFERENCE⊕Symmetric Difference

Operator Precedence (Highest to Lowest)

1. Function calls, method calls, indexing []

2. Unary negation -, !! (NOT)

3. Exponentiation ^

4. Multiplication *, Division /, Modulo %

5. Set operations UNION, INTERSECTION, DIFFERENCE, SYMMETRIC_DIFFERENCE

6. Addition +, Subtraction -, Concatenation ++

7. Comparisons HAS, >, <, >=, <=

8. Equality ==, !=

9. Logical AND, &&

10. Logical OR, ||