Type Overview
A tour of Nexus types, initializing, and more.
Primitive Types
Nexus is statically typed. All primitives have explicit sizes. There is no implicit numeric coercion.
| Type | Description | Example |
|---|---|---|
i32 | 32-bit signed integer | i32 x = 42; |
i64 | 64-bit signed integer | i64 big = 9999999999; |
f32 | 32-bit float | f32 pi = 3.14; |
f64 | 64-bit float | f64 e = 2.718281828; |
bool | Boolean | bool flag = true; |
str | UTF-8 string | str name = "Nexus"; |
As of 1.3 char type is not yet implemented. (Kind of forgot about it)
Same as in many languages. true is 1 and false is 0
Variables & Assignment
Variables are declared with their type (No null declaration). Nexus distinguishes between copy assignment (=) and explicit move (<-), giving you control over ownership at every assignment site.
copy vs move
i32 x = 10; /* copy */
i32 y <- x; /* explicit move — x is no longer valid */
i32 tmp &= y; /* borrow reference */
| Variable Declaration | Semantics |
|---|---|
T x = value | Copy assignment |
T x <- value | Explicit move (transfers ownership) |
T x &= value | Borrow (reference, not ownership) |