Keywords
The following identifiers are reserved keywords in Zynx and cannot be used as variable, function, or type names.
| Keyword | Description |
|---|---|
as | Type cast or import alias |
asm | Inline assembly block |
assert | Runtime assertion |
async | Declare or call an asynchronous function |
await | Suspend until an async value is ready |
break | Exit the innermost loop |
case | Branch in a match arm |
catch | Handle an error union inline |
const | Declare a compile-time constant or immutable binding |
continue | Skip to the next loop iteration |
defer | Run a statement when the current scope exits |
distinct | Create a nominally distinct type alias |
else | Alternative branch of an if or match |
enum | Declare an enumeration |
error | Declare an error type |
export | Make a declaration visible outside the current module |
extern | Declare a symbol defined in a foreign (C) library |
fn | Declare a function |
for | Iterate over a collection |
from | Selective import (from mod import symbol) |
if | Conditional branch |
import | Import a module |
in | Specify the iterable in a for loop |
interface | Declare a structural interface |
let | Declare a local variable |
match | Pattern-match on a value |
raw | Raw pointer dereference or cast |
return | Return a value from a function |
struct | Declare a structure |
test | Declare a test block |
try | Propagate an error union; unwraps the value or returns the error |
type | Declare a type alias |
union | Declare a C-compatible union |
while | Loop while a condition holds |
Reserved identifiers
The following identifiers have special meaning in certain positions but are not reserved keywords — they can still be used as variable names, though doing so is discouraged:
| Identifier | Context |
|---|---|
true | Boolean literal |
false | Boolean literal |
null | Null pointer literal |
require | Built-in dynamic module loader |
self | Receiver in struct/interface methods |