Operations
An operation combines one or more values with an operator to produce a result. Rux groups its operators into the categories below; each has a dedicated page with the full operator list, semantics, and examples.
| Category | Operators | Result |
|---|---|---|
| Arithmetic | + - * / % ** | A numeric value |
| Comparison | == != < <= > >= | A bool |
| Logical | && || ! | A bool |
| Bitwise | & | ^ ~ | An integer (per-bit) value |
| Shift | << >> | An integer value |
| Type Casts | as | The value in the target type |
| Type Tests | is | A bool |
A Shared Rule: No Implicit Conversion
Across every category, Rux never converts between distinct types on your behalf. The operands of a binary operation must already share a type; when they differ, convert one side explicitly with the as cast:
let count: int32 = 10;
let scale: int64 = 2;
let invalid = count * scale; // error: different operand types
let valid = (count as int64) * scale; // int64This rule keeps the type of every expression visible in the source rather than hidden behind silent promotions.
Precedence
When several operators appear in one expression, precedence decides the grouping — for example ** binds tighter than *, which binds tighter than +. Each page summarises the precedence relevant to its operators; the Operator Precedence table lists every level in one place. Use parentheses whenever the intended order is not obvious.
See Also
- Operators and Punctuation — the complete operator and precedence reference
- Type Casts — the
asoperator used throughout this chapter