Keyword Use
moduleName the file’s module
useImport names; embed fields; bring fields into scope
lib, asDeclare C functions (use lib "x" as y); as also casts
pubExport an item
fnFunction or method
struct, enumTypes
constModule constant
letLocal variable (always mutable)
if, elseBranch, or a value
while, for, inLoops
matchBranch on an enum
return, break, continueLeave a function or loop
deferRun at end of block
operatorDefine an operator method
thisMethod receiver
Integers int (= i64), i8, i16, i32, i64, u8, u16, u32, u64
Floats float (= f64), f32, f64
Other bool, void, string, ptr, cstr
Arrays [N]T (fixed), []T (slice)
Pointers &T
Functions fn(A, B): R
Attribute Meaning
#[Debug]Printable in string interpolation
#[TryCatch(Ok, Err)]Enum works with ?
#[singleton]Process-wide value
#[thread]Per-thread (with #[singleton])
#[shader] #[vertex] #[varying] #[uniform] #[flat]Shader code and data (Shaders )
@sizeof, @slice, @syscall, @atomicLoad, @atomicStore, @atomicAdd, @atomicSub, @atomicExchange, @atomicCas, @vmin, @vmax, @vsqrt, @vabs, @vsum, @vshuffle, @vfloat, @vint, @vload, @vstore, @script, @j3ui, @uiChoice, and the shader builtins and @shader (Shaders )
Arithmetic + - * / %
Bits (integers) & | ^ ~ << >>
Compare == != < <= > >=
Logic && || !
Assign = += -= *= /= %= &= |= ^=
Pointers &x (address), *p (deref)
Ranges a..b, a..=b, xs[a..b], xs[:]
Errors expr?
No interfaces or inheritance; traits are structural (a type has the methods, no impl blocks). Closures cannot escape (no heap environments): a closure(..) is a parameter or a let. No garbage collector or borrow checker. No null and no exceptions. No mutable globals besides #[singleton].