Variable names are never confused for keywords in the langur scripting language, as they are qualified with a dot or underscore, such as .var or _var. Technically, _var is a shortcut for ._var. System variable names begin with an underscore and user-defined variable names do not.
Variable names may use ASCII letters, numbers, and underscores, and may start with a number. Some might find it liberating to use Unicode for identifiers, but I think that would be a headache. A single underscore is not a variable, but the no-op token.
|_rev||the langur revision number string, such as 1.7.3|
|_env||a hash of environment variables with keys and values as strings|
|_args||an array of strings of the arguments following the script name|
|_script||the name and path of the script being executed|
Immutable declarations use a val token and mutable declarations use a var token.
You should use immutable declarations for most things.
An immutable declaration must be combined with an assignment.
Mutable declaration without assignment will set the variable implicitly (to something such as null).
|val .x = 123||immutable declaration and assignment|
|var .y = 123||mutable declaration and assignment|
|var .z||mutable declaration without explicit assignment|
|.y = 789||assignment to mutable variable (previously declared)|
Assignment, with or without declaration, is an expression and is right-associative. This allows you to use assignment within an expression. It also allows you to write a chained assignment, such as the following.
var .x = .y = val .z = 7 # sets all to 7 ... # ... 2 values mutable ... # ... (1 previously declared) ... # ... and 1 immutable