Arithmetic Operators¶
CrossBasic provides the standard set of arithmetic operators for numeric calculations. These work on both Integer and Double values (with mixed‐type operands promoting to Double).
| Operator | Description | Example | Result |
|---|---|---|---|
+ | Addition | 5 + 3 | 8 |
- | Subtraction | 10 - 4 | 6 |
* | Multiplication | 7 * 6 | 42 |
/ | Floating-point division | 7 / 2 | 3.5 |
\ | Integer division (truncating) | 7 \ 2 | 3 |
Mod | Remainder (modulo) | 7 Mod 2 | 1 |
^ | Exponentiation | 2 ^ 3 | 8 |
Precedence¶
Operators are evaluated in this order (highest first):
^*,/,\,Mod+,-
Parentheses can be used to override:
```xs Print((2 + 3) * 4) // 20, not 14