← Back to Docs

Variables (let)

Variables are declared with let and can hold strings, integers, floats, booleans, arrays, or objects.

Declaration

let name = "VDX";
let age = 1;
let result = 10 + 5;

Reassignment

After declaring a variable with let, you can reassign it without let:

let x = 10;
x = 20;        // reassign
print(x);      // 20

⚠️ You cannot reassign a variable that was never declared with let. This will throw a runtime error.

Types

TypeExample
String"hello"
Integer42
Float3.14
Booleantrue / false

You can add optional type annotations for runtime checking. See Types.

Using variables in print

let lang = "VDX";
print("Language:", lang);    // Language: VDX

Class-scope access with this

Variables declared at the class level can be accessed with this.name. See this keyword.

class App {
    let version = 1;
    print(this.version);   // 1
}