Variables & Constants
In Astra, variables are dynamically typed — you don't need to declare a type. Just assign a value and Astra figures out the rest.
Variables
Assign a value using =. No var, let, or def needed.
Variables can be reassigned to any type at any time:
Constants
Use const to declare a constant — a value that cannot be changed after assignment.
⚠️ Note: Attempting to reassign a constant will throw a compile-time error.
Data Types
Astra supports the following data types:
| Type | Example | Description |
|---|---|---|
| Integer | x = 42 | Whole numbers (64-bit) |
| Float | x = 3.14 | Decimal numbers |
| String | x = "hello" | Text in double quotes |
| Boolean | x = true | true, false, or maybe |
| Pointer | p = adr(x) | Memory address of a variable |
Tri-state Boolean
Astra's boolean system has three states — true, false, and maybe. This is unique to Astra and useful for representing uncertainty.
💡 Tip:
maybe is perfect for representing uncertain or pending states — like a task that is neither complete nor incomplete.Multi-Assignment
Assign multiple variables in a single line:
Range Assignment
Assign a range of values to a range of variables using --:
Operators
Increment & Decrement
Compound Assignment
Alias
Create an alias for a variable — useful for sharing global variables inside functions:
Variable Inspector
Use info to inspect a variable at runtime: