← Back to Docs
Operators
VDX supports arithmetic, comparison, and equality operators.
Arithmetic
| Operator | Description | Example |
|---|---|---|
+ | Addition | 3 + 2 → 5 |
- | Subtraction | 10 - 4 → 6 |
* | Multiplication | 3 * 4 → 12 |
/ | Division (integer) | 7 / 2 → 3 |
Comparison
| Operator | Description | Example |
|---|---|---|
< | Less than | 3 < 5 → true |
> | Greater than | 5 > 3 → true |
<= | Less or equal | 3 <= 3 → true |
>= | Greater or equal | 5 >= 3 → true |
Equality
| Operator | Description | Example |
|---|---|---|
== | Equal | 5 == 5 → true |
!= | Not equal | 5 != 3 → true |
String concatenation
The + operator also concatenates strings:
let greeting = "Hello" + " " + "world";
print(greeting); // Hello worldPrecedence
From highest to lowest:
*/— multiplication, division+-— addition, subtraction<><=>=— comparison==!=— equality
Use parentheses () to override precedence.
Division by zero
Dividing by zero throws a runtime error:
[VDX] Division by zero