/*
 * File: reference_parameters.txt
 * ------------------------------
 */

/* The only way to send a variable AND its sub-variables to a function is
   by reference. You can add ref before a parameter name for this purpose. */
printSubVariables = function(ref var) {
    for (e: var) { wln(tostring(e)); }
};

for (i = 1, 10) {
    arr[i] = i*i;
}
printSubVariables(arr);
wln();

/* Modifying a reference parameter inside the function will change the variable
   passed as argument. */
multiply = function(ref a, k) {
    a *= k;
};
x = 5;
multiply(x, 10);
wln(tostring(x));

