-
Notifications
You must be signed in to change notification settings - Fork 0
sub operator
ffredyk edited this page Jul 23, 2026
·
1 revision
Arithmetic
Binary — left - right (subtraction).
Unary — -value (negation prefix).
<number> - <number> // binary: subtract
-<number> // unary: negate
Binary form: subtracts right operand from left operand. Returns the difference. Unary form: negates the operand (flips sign). Returns the negated value.
Auto-unwraps shared values before operating.
The host re-registers - with enhanced behavior that unwraps shared values. Both forms ultimately perform double arithmetic. The compiler distinguishes unary from binary form by operand count.
Unary negation: -5 → compiled as nular 5 then unary - opcode.
_result = 10 - 3; // 7
_damage = _incoming - _armor;
_remaining = _max - _current;_x = -5; // -5
_vel = -_speed; // negate variable
_delta = -(_a - _b); // negate expressionshared _count = 10;
_new = get _count - 3; // auto-unwrapsNot atomic on shared values — use sub for atomic decrement. Regular subtraction on primitives is thread-safe.
- Getting Started
- Language Guide
- Type System
- Control Flow
- Functions & Code
- Strings & Text
- Arrays & Collections
- Concurrency
- Promise System
- Thread Safety
- Host API & Embedding
- CLI Tool
- Bytecode Reference
- Multiplayer
- Syntax Sugar
- Optimization Guide
- Benchmarks
- count
- select
- pushBack
- append
- deleteAt
- deleteRange
- resize
- reverse
- sort
- find
- in
- forEach
- freeze
- thaw
- isFrozen
- currentScheduler
- clientOwner
- allSchedulers
- schedulerName
- schedulerExists
- schedulerBudget
- setSchedulerBudget
- fiberCount
- readyFiberCount
- waitingFiberCount
- schedulerLoad
- sendTo