Local Variables

> Declare typed, named variables on a route or function, then place Get and Set nodes for them anywhere in the flow.

Local variables are the typed, UE5-Blueprint-style way to keep per-run state inside a route or function. You declare them once in the detail panel -- with a name, a pin type, a shape, and a default value -- and the Builder gives you nodes to read and write them.

Use local variables for new flows. The older state variables still exist for dynamic names and compatibility, but they are untyped.

Declaring a variable

Open the detail panel of a route or function. The Variables section has a Create variable button at the top and lists every variable below it.

Each variable has:

| Field | Description | |-------|-------------| | Name | Unique within the route or function. Letters, numbers and underscores. | | Type | Any Brickr pin type, including objects and enums. | | Shape | Single or Array. The shape is separate from the type, so a string, enum, object, or asset reference can be single or array. | | Default value | The value the variable holds at the start of every run. The input adapts to the type -- a switch for booleans, a dropdown for enums, a per-field editor for structured objects, and a list for arrays. | | Editable | On by default. When on, a Set node is available so the flow can change the value. Turn it off for read-only values that should only use their default. |

A variable's type and shape cannot be changed after it is created. Delete the variable and create a new one if you need a different type.

Managing variables

In the detail panel, each variable row shows a colored type dot and its name.

  • Edit -- click a row to open its settings (default value, editable toggle).
  • Rename -- double-click the name, type the new name, and click away. Invalid or duplicate names revert.
  • Delete -- the delete button removes the variable and any placed Get / Set nodes for it.

Placing Get and Set nodes

There are three ways to place a variable node:

  • Drag the variable from the detail panel onto the canvas. For an editable variable a small menu appears at the drop point with Get (shortcut g) and Set (shortcut s). For a non-editable variable a Get node is placed directly.
  • Quick menu -- open the canvas quick menu and pick the variable under the Variables section to place a Get node.
  • Node dock -- the floating dock lists the variables under Variables; drag or click to place.

Get node

> Pure node with a single output -- the current value of the variable.

| Pin | Direction | Type | |-----|-----------|------| | value | out | The variable's type |

The Get node has no sequence pins. It resolves to the variable's value wherever it is read.

Set node

> Available only for editable variables. Writes a value into the variable.

| Pin | Direction | Type | |-----|-----------|------| | sequence in | in | sequence | | value | in | The variable's type | | sequence out | out | sequence | | value | out | The variable's type |

The Set node runs in the flow like any impure node and passes the written value through its value output.

Arrays and objects

Array variables keep their element type. A string array variable outputs a string array; an object:Profile array variable outputs an array of Profile objects.

To update an array variable, read it with Get, use array nodes such as Add to Array, and write the result back with Set.

For structured object variables, the default editor shows the object's fields. Use Set Members when you only want to change selected fields of an object and keep the rest of the value unchanged.

Raw object:any variables are intentionally flexible. They do not have a fixed field editor; initialize or reshape them with object nodes such as Create Object, Cast Object, Split Object, and Set Members.

Defaults and runtime

At the start of every run each variable is seeded into the execution state with its default value. A Get node before any Set node returns the default. After a Set node runs, later Get nodes return the new value for that run.

Variables are not saved back to the route, function, asset, or workspace. Use database or storage nodes for data that should persist across requests.

Renaming a variable updates every placed Get and Set node automatically -- the nodes reference the variable by id, not by name.

What's next?

| Topic | Description | |-------|-------------| | State Variables | Untyped Set / Get Variable nodes | | Objects | Reusable typed objects you can use as a variable type | | Enums | Fixed value sets you can use as a variable type |