Literals & Expressions
Numeric, string, array, map, and interpolated literals plus every expression form.
Numeric literals
Int64 literals must fit in a signed 64-bit value (VNE-007). ** always produces a Float64; integer exponentiation would otherwise overflow silently.
Strings and interpolation
Strings are double-quoted and UTF-8. A { ... } segment inside a string interpolates an expression:
Backslash escapes are recognized inside literals. Interpolation is the readable alternative to repeated + and string(...) calls.
Arrays and maps
A typed array requires every element to be compatible with the declared element type. A bare Array is boxed and accepts mixed values.
Ranges and slices
Ranges are the input to through. The inclusive upper bound is part of the range value, so 0..9 has ten elements. sequence(lo, hi) is the built-in that generates values from lo up to but excluding hi.
Array slice bounds are half-open: xs[1:3] selects elements 1 and 2. An ordinary array slice copies its elements. When the expected type is Slice<T> (a typed declaration or function parameter), the compiler instead creates a zero-copy borrow over a typed numeric array. See Slice views.
Calls and member access
Method calls resolve through a fixed dispatch chain: native module methods, interface constructors, group methods, built-in array methods, string methods, typed-array methods, and boxed fallbacks.
Operators
| Family | Operators | Notes |
|---|---|---|
| Arithmetic | + - * / % ** // | / is floating division; // is floor division |
| Comparison | == != < <= > >= | == is deep for arrays, maps, and structs |
| Logical | && || ! | short-circuit |
| Bitwise | & | ^ ~ << >> | supported on both backends |
| Membership | in | collection-dependent |
| Range | .. | inclusive |
| Null handling | ?? ??= | fallback and conditional assignment |
| Composition | |>, ?: | pipeline and ternary |
| Reference | ^^, $ | reference parameters and address-of |
The pipeline inserts the left value as the first argument: 10 |> add(3) is add(10, 3), and 4 |> square() is square(4).
Assignment is not an expression
:= declares and = reassigns; neither returns a value. Use a separate statement when you need a result. ??= is the exception in spirit: it conditionally assigns and is used as a statement.
Casts and conversions
Conversion failures follow the runtime rules of the target: integer parsing saturates rather than trapping, and arithmetic wraps on Int64.
See also
- Operators for the full precedence table.
- Variables & Assignment
- Collections & Built-ins