Operators
Arithmetic
| Operator | Description |
|---|---|
+ |
Addition |
- |
Subtraction |
* |
Multiplication |
/ |
Division |
% |
Modulo |
Works with both number and integer types (i32, u8):
Integer division truncates toward zero. Integer and float types cannot be mixed in arithmetic — see Type System for details.
Comparison
| Operator | Description |
|---|---|
== |
Equal |
!= |
Not equal |
< |
Less than |
> |
Greater than |
<= |
Less than or equal |
>= |
Greater than or equal |
Comparisons between integer and number types are allowed — the compiler inserts implicit conversion. See Type System.
Logical
| Operator | Description |
|---|---|
&& |
And |
\|\| |
Or |
! |
Not |
String Concatenation
The + operator concatenates strings: