---
title: "Set"
description: "Create named variables in the current (local) scope."
canonical_url: "https://docs.vettero.com/build/workflows/blocks/context/set"
---
# Set

> Create named variables in the current (local) scope.

<block-meta block="Yes" channels="Any" folder="basic/context" group="Context" groupTo="/build/workflows/blocks/context" icon="i-lucide-square-pen" pipe="Value" scope="Any" tool="No" type="ctx.vars.set">



</block-meta>

**Set** (palette name **Set**) writes named variables in the **current** scope. Inside a [loop](https://docs.vettero.com/build/workflows/blocks/loops) body those names stay in that body. Use [Update](https://docs.vettero.com/build/workflows/blocks/context/update) to change a name that already exists outside this body.

You can also set starting names on [Start](https://docs.vettero.com/build/workflows/blocks/module/start) and [Lambda](https://docs.vettero.com/build/workflows/blocks/module/lambda) instead of a separate Set block.

Each row is a **Key** plus a **Value** (fixed or a context path). The same object is written to the data pipe.

## Configure

<table>
<thead>
  <tr>
    <th>
      Setting
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Key
      </strong>
    </td>
    
    <td>
      Name other blocks will use (for example <code>
        status
      </code>
      
      ). Must be a valid Liquid and JavaScript identifier; reserved names such as <code>
        args
      </code>
      
       are not allowed.
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Value
      </strong>
    </td>
    
    <td>
      Literal or a variable path from this block’s context
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Add variable
      </strong>
    </td>
    
    <td>
      Appends the row
    </td>
  </tr>
</tbody>
</table>

Add as many rows as you need. Duplicate keys are ignored.

## Handles

<table>
<thead>
  <tr>
    <th>
      Handle
    </th>
    
    <th>
      Role
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        In
      </strong>
      
       (target)
    </td>
    
    <td>
      Incoming connection
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Out
      </strong>
      
       (source)
    </td>
    
    <td>
      Continues after the names are set
    </td>
  </tr>
</tbody>
</table>

## Pipe schema

The next block reads this on the data pipe (`pipe.value`).

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Set variables
    </td>
    
    <td>
      object
    </td>
    
    <td>
      One property per <strong>
        Key
      </strong>
      
      , with that row’s resolved value
    </td>
  </tr>
</tbody>
</table>

Downstream blocks can also bind the names directly (`status`, not only `pipe.value.status`).

## Use case

- Inside a loop body, name the current item or a computed flag without changing the outer run.
- Build a small object of working values for the next few blocks in this scope.
- On the main path, create `total` = `0` before a loop, then [Update](https://docs.vettero.com/build/workflows/blocks/context/update) `total` inside the loop.

<block-page-nav>



</block-page-nav>


## Sitemap

See the full [sitemap](https://docs.vettero.com/sitemap.md) for all pages.
