Skip to content

Variables Down

Benedict Albrecht edited this page May 20, 2026 · 3 revisions

Variables: :down Scope

The :down scope makes a variable visible only for downstream (child) elements. It follows hierarchical order: new overwrites old.

Syntax

<< name:down >>

Example

class C1 ( ) {
  let hhh ;

  function F1 ( hhh ) {
    let bbb = hhh;
  }

  let ccc = hhh;
}

With :down scope

<:function:>
     function <<title>> ( <<NAME:down>> ) { <---> }
<:>
<:let:> let <<NAME>> <| = <<'name'>> <||> |> ; <:>

The function parameter hhh (declared with :down) is only visible within the function body:

  • let bbb = hhh → resolves to the parameter hhh (downstream of function)
  • let ccc = hhh → resolves to the outer let hhh (the parameter is not visible at the sibling level)

Compared to default (:following)

<:function:>
     function <<title>> ( <<NAME>> ) { <---> }
<:>
<:let:> let <<NAME>> <| = <<'name'>> <||> |> ; <:>

With default scope, the parameter would also be visible to younger siblings, causing let ccc = hhh to resolve to the parameter instead of the outer variable.

Clone this wiki locally