Every penscript expression runs within a scope — the collection of variables available at evaluation time. The scope contains form data, contact information, case data, and system values. Operators read from the scope to produce dynamic results.Documentation Index
Fetch the complete documentation index at: https://docs.penbox.io/llms.txt
Use this file to discover all available pages before exploring further.
Referencing Variables
Variables are referenced using curly braces:System Variables
penscript provides built-in system variables available in every scope.| Variable | Description |
|---|---|
{$today} | The current date |
$ to distinguish them from user-defined data.
Inline Pipes
Variables support pipe expressions for inline transformations — lightweight operations applied directly inside a string reference, without needing a full JSON operator.Inline Comparisons & Ternaries
Simple logic can be expressed directly inside strings, without switching to JSON operators like:if or :cmp. This keeps lightweight conditions readable and compact.
Boolean comparisons:
:if or :case JSON operators instead.
Scope Resolution
When an expression references a variable, penscript resolves it by looking through the current scope. If a variable is not found, the reference resolves toundefined rather than throwing an error.
In nested contexts — like a :map loop inside a :define block — inner scopes can access variables from outer scopes. If a variable name exists in both the inner and outer scope, the inner scope takes precedence.
The full variable reference — all namespaces, every available key, and where each can be used — is documented in the Reference section.
Next Steps
How penscript works
Expression modes and operator composition
Logic & comparisons
Conditions, branching, and boolean logic
Numbers & calculations
Arithmetic and formatting
Reference
Full variable reference