Always Statement
The "always" statemernt is a for the user to specify that a set of statements should be re-executed whenever the value of an expression changes or, as in a spreadsheet, that the value of a variable should re-calculated whenever any of the arguments to a calculation involving other variable changes.
There are three forms of the always statement. The simplest has only an assignment statement. The assignment is re-executed whenever its resulting value would change if re-calculated.
Another form also includes a block of statements to also be executed whever the assignment is re-executed.
Finally the third form is similar but instead of an assignment, only the expression portion of the assignment is used, and the block of statements is mandatory.
Always statements are always evaluated on the client side
Always statements detect changes to expression values using logic that runs only on the client side. Therefore, the return values of expressions used in always statements will be forced to reside on the client or on both client and server. Sensitive data such as passwords, should not be used as the arguments to expressions in always statements.
Always statements don't run until invoked.
When an always statement appears in a sequence of statements, it tells exotool to begin detecting changes to the expression value and reacting to them. No detection or changes occur until the always statement is first invoked.
It is therefore up to the user to "start" an always statement by executing it, for example, when the application first starts. Otherwise, the always statement will not work properly.
Formats:
always [variable reference] = [expression]
always [variable reference] = [expression] { [statements] }
always [expression] { [statements] }
Examples
always beta = alpha + 2
always gamma = alpha + 3 {
alert("gamma changed because alpha changed")
}
always alpha {
time_of_alpha_change = now()
}