Skip to main content
These examples have been checked using Waher.Script 2.15.0. They require no host variables or external service. Your Neuron still determines whether each function is allowed in a particular execution context. For the full syntax and function catalog, use the original Script reference. The entries describe tested input types. They are a focused application reference, not a claim that every runtime overload or extension is available. See execution contexts and persistence before embedding them in a contract.

Abs(x)

Real number; returns non-negative magnitude.
Expected result: 3. Selected function source.

Round(x)

Real number; returns the nearest integer-valued number, with midpoint ties to even.
Expected result: 2. Selected function source.

Floor(x)

Real number; returns the greatest integer-valued number no larger than the input.
Expected result: -3. Selected function source.

Ceiling(x)

Real number; returns the least integer-valued number no smaller than the input.
Expected result: -2. Selected function source.

Min(x, y)

Two real numbers; returns the smaller value.
Expected result: 3. Selected function source.

Max(x, y)

Two real numbers; returns the larger value.
Expected result: 8. Selected function source.

Number(x)

Numeric text in the tested example; returns a number. Invalid numeric text raises an error. Alias: Num.
Expected result: 12.5. Selected function source.

String(x)

Numeric value in the tested example; returns its text representation. Alias: Str.
Expected result: "12.5". Selected function source.

Length(s)

String; returns the string length. The tested example is ASCII text.
Expected result: 5. Selected function source.

Trim(s)

String; returns text with leading and trailing whitespace removed.
Expected result: "note". Selected function source.

StartsWith(s, prefix)

Two strings; returns whether the string begins with the prefix.
Expected result: true. Selected function source.

Sum(v)

Vector of real numbers; returns their sum.
Expected result: 6. Selected function source.

Count(v)

Vector; returns the number of entries.
Expected result: 3. Selected function source.

Handle invalid input

Number("not a number") raises an evaluation error in the same test suite. Validate input types and choose a deliberate error or fallback policy. Round uses ties-to-even; a payment integration must define its own units and rounding requirements. The reference metadata records source revision and test-case identifiers. Each entry includes the expression and expected result; start with the Script quickstart for a worked calculation.