Skip to main content
For the full syntax and function catalog, use the original Script reference. Function availability depends on the execution context. This example calculates a line total and rejects a non-positive quantity. The examples below show the expression, inputs, and expected result before you embed it in a contract.

1. Calculate a value

Assign values with := and separate statements with semicolons:
The result is 36. In a contract, the parameter definitions supply the input values; do not overwrite those inputs with the quickstart’s sample assignments.

2. Validate the inputs

With the values above, this returns true. With Quantity:=0, it returns false. Use a validation expression where a contract parameter needs this constraint; see contract parameters.

3. Check the expected results

These core expressions have been checked with Waher.Script 2.15.0: Use these inputs when checking your own expression in its supported contract or state-machine context. A correct core calculation does not establish host permissions, available variables, signatures, or persistent state.

4. Embed a calculated machine value

In a state-machine action, an expression-valued attribute uses braces:
This is a fragment for an action with an existing numeric Count variable. Without braces, a scriptable attribute can be interpreted as a literal rather than a calculation. Validate the complete XML using the validation guide, then test the machine on your development Neuron. Continue with language basics and state machines.