Variables - markpwns1/Dormez GitHub Wiki
Variables in Dormez are declared using the declare
keyword.
declare x = 5;
declare y;
If a variable is not assigned a value when it is declared, its value will be undefined
.
Variables obey scoping rules identical to most other languages.
// prints 5
declare x = 5;
{
console.print(x);
}
// Throws an error
{
declare y = 5;
}
console.print(y);
Functions, tables, and templates may be defined normally:
declare myFunction = function {
// ...
}
declare myTable = table {
// ...
}
declare MyTemplate = template {
// ...
}
Or using the shorthand version:
declare function myFunction {
// ...
}
declare table myTable {
// ...
}
declare template MyTemplate {
// ...
}