GitHub

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.

TypeDescriptionExample
i3232-bit signed integeri32 x = 42;
i6464-bit signed integeri64 big = 9999999999;
f3232-bit floatf32 pi = 3.14;
f6464-bit floatf64 e = 2.718281828;
boolBooleanbool flag = true;
strUTF-8 stringstr 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 DeclarationSemantics
T x = valueCopy assignment
T x <- valueExplicit move (transfers ownership)
T x &= valueBorrow (reference, not ownership)
Conditionals