-
Notifications
You must be signed in to change notification settings - Fork 0
1 : Variables
Paulyn edited this page Nov 28, 2025
·
1 revision
LAT supports two main variable types:
-
Global variables
-
Local variables (
nat)
A global variable is created simply by assigning to a name:
x = 10 x = x + 5
-
Exists for the entire program duration
-
Can be accessed by any function
-
Can be overwritten without restrictions
-
Does not require a type annotation
x = 2call add() x = x +
10 doneadd()
print(x) -- prints 12
Local variables must use the nat keyword:
nat score = 0 nat health = 100
-
Exists only within the current block
-
Cannot be accessed outside the function
-
Must be initialized at declaration
-
Shadowing globals with the same name is allowed
x = 50call test() nat x =
5 print(x) -- prints 5 (local) donetest()
print(x) -- prints 50 (global)