ZPE 1.14.2 (Stonegate, February 2026) introduced support for scope blocks.
Scope blocks define an area of code which is an isolated scope for variables.
Anything defined inside a block (or {{) ... end block (or }}):
- Exists only inside that block
- Can see variables from outer scopes
- Does not affect outer variables unless explicitly intended
When the block ends, all variables created inside it are discarded.
$x = 10 print($x) block $x = 5 print($x) end block print($x)
10 5 10
Blocks can see outward
Scope blocks can see variables outwards, but cannot modify them (they are immutable).
$score = 3 {{ // Block can read outer variables $score = $score + 2 print($score) }} // Outer variable is unchanged print($score)
The block reads the outer $score, but its change does not persist.
Blocks vs functions in YASS
This is an important distinction:
| Construct | Creates a scope? | Purpose |
|---|---|---|
block
|
Yes | Temporary variable isolation |
function
|
No | Code reuse, shared parent scope |
private
|
Yes | Explicit function-local variables (also used in objects, structures and classes but for a different purpose) |
Why scope blocks exist
Scope blocks are useful when you want to:
- Use temporary variables without polluting outer scope
- Avoid accidental variable reuse
- Keep logic readable and safe
- Teach scoping without complex rules
They provide isolation without introducing new functions.
Key rule to remember
Blocks can borrow variables from outside, but they never give variables back. This makes block scope predictable, explicit, and easy to reason about.

There are no comments on this page.
Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days.
Comments powered by BalfComment