Skip to main content

Data Types

Aura is a strongly and statically typed language. Every value has a specific type that is checked at compile-time.

Primitive Types​

Aura provides several built-in primitive types:

TypeDescriptionExample
number32-bit signed integer (i32)42
i6464-bit signed integer10000000000L
f3232-bit floating point3.14f
float64-bit floating point (f64)2.718
stringUTF-8 encoded string"Hello Aura"
booleanBoolean valuetrue or false
nullRepresents the absence of a valuenull
voidRepresents no value (functions only)void

Compound Types​

Arrays​

Arrays are ordered collections of values of the same type. They are declared using square brackets [].

let scores: number[] = [95, 88, 72];
let firstScore = scores[0]; // 95

Union Types​

Union types allow a variable to hold values of multiple different types.

let id: string | number = 101;
id = "U-102"; // OK

Object Types​

Object types define the structure of anonymous objects.

let user: { name: string, active: boolean } = {
name: "Alice",
active: true
};

Type Testing (is)​

You can check if a value is of a certain type using the is operator. This is particularly useful when working with Union types.

let val: string | number = "hello";

if (val is string) {
print "It's a string!";
}

[!IMPORTANT] Aura does not have an any or unknown type in the language design to ensure complete type safety across the entire codebase.