Skip to content

Variables

Humbat edited this page Sep 8, 2026 · 1 revision

Variables & Primitive Types

In Tera, variables use a unique directional pattern using the arrow operator (=>) to assign an expression to a typed variable.


1. Explicit Typing

Variables are declared using the syntax let <identifier>: <expression> => <type>. Here are examples of the primary primitive types supported in Tera:

let x: 10 => int;
let name: "Tera" => string;
let isActive: true => bool;
let weight: 65.5 => float;

2. Uninitialized Variables & undefined

Declaring a variable without an immediate value assignment is fully permitted in Tera[cite: 1].

If a variable is declared without any assignment, it defaults to the value undefined[cite: 1].

If you declare it with an explicit type but no value, the type is bound, but its runtime value is still undefined[cite: 1].

let x;                  // Evaluates to undefined[cite: 1]
let name: string;       // Declared type 'string', value is undefined[cite: 1]

x = 100;                // Re-assignment[cite: 1]

Clone this wiki locally