The language specify no constructs for variable declaration and type specification. The interpreter uses following inner data types which can be dynamically changed with assign command.
All variables are defined as local and are valid only it the scope of the current function (function not block). To define/use a global variable, use global keyword with the variable name.
function setGlobal(val) { global g_var; g_var = val; // g_var is global } function main(argv) { println(g_var); // g_var is local setGlobal("test"); println(g_var); // g_var is local global g_var; println(g_var); // g_var is global }
NULL NULL test
Use special &= operator to assign a reference to the variable and to create an alias.
var = 1; ref &= var; // ref is now alias of var println("var = " + var); println("ref = " + ref); var = 2; println("var = " + var); println("ref = " + ref); ref = 3; println("var = " + var); println("ref = " + ref);
var = 1 ref = 1 var = 2 ref = 2 var = 3 ref = 3