In Tera, variables use a unique directional pattern using the arrow operator (=>) to assign an expression to a typed variable.
=>
Variables are declared using the syntax let <identifier>: <expression> => <type>. Here are examples of the primary primitive types supported in Tera:
let <identifier>: <expression> => <type>
let x: 10 => int; let name: "Tera" => string; let isActive: true => bool; let weight: 65.5 => float;
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]
There was an error while loading. Please reload this page.