runningTotal = this.runningTotal + myCustomer.customerBalance;
Here
the local runningTotal variable is initialized with
the value of the runningTotal variable from main(),
then the balance from the current customer is added to the local total.In rare cases, you can use the this keyword to override a behavior of a set-values block in an assignment statement. Here this establishes the scope as being the declaration in which the set-values block resides. For details, see Set-values blocks.
program myProgramA type BasicProgram
varX STRING = "program";
function main()
varX STRING = "main";
myFunctionB();
end
function myFunctionB()
varX STRING = "Function B";
writeStdErr(this.varX);
end
end
The variable this.varX displays the value "program" on the console, because the program is the main logic part that holds myFunctionB().