XCX 3.0 Operators
Arithmetic Operators
| Operator | Description | Example | Result |
|---|---|---|---|
+ |
Addition | 10 + 3 |
13 |
- |
Subtraction / Unary Negation | 10 - 3 |
7 |
* |
Multiplication | 10 * 3 |
30 |
/ |
Division (truncates for i) |
10 / 3 |
3 |
% |
Modulo (Remainder) | 10 % 3 |
1 |
^ |
Exponentiation | 2 ^ 10 |
1024 |
++ |
Integer Digit Concatenation | 48 ++ 77 |
4877 |
String Operators
| Operator | Description | Example | Result |
|---|---|---|---|
+ |
Concatenation | "Hi " + "User" |
"Hi User" |
HAS |
Substring search | "Search" HAS "ear" |
true |
[!TIP] String concatenation automatically converts numbers and booleans to strings (e.g.,
"Value: " + 42→"Value: 42").
Logical Operators
| Operator | Alias | Description |
|---|---|---|
AND |
&& |
Logical AND |
OR |
|| |
Logical OR |
NOT |
!! |
Logical NOT |
Comparison Operators
Used for comparing values of the same type.
| Operator | Description |
|---|---|
== |
Equal to |
!= |
Not equal to |
< |
Less than |
> |
Greater than |
<= |
Less than or equal to |
>= |
Greater than or equal to |
Set Operators
| Word | Symbol | Description |
|---|---|---|
UNION |
∪ |
Set Union |
INTERSECTION |
∩ |
Set Intersection |
DIFFERENCE |
\ |
Set Difference |
SYMMETRIC_DIFFERENCE |
⊕ |
Symmetric Difference |
Operator Precedence (Highest to Lowest)
- Function calls, method calls, indexing
[] - Unary negation
-,!!(NOT) - Exponentiation
^ - Multiplication
*, Division/, Modulo% - Set operations
UNION,INTERSECTION,DIFFERENCE,SYM_DIFF - Addition
+, Subtraction-, Concatenation++ - Comparisons
HAS,>,<,>=,<= - Equality
==,!= - Logical
AND,&& - Logical
OR,||