---
title: "For In"
description: "Run the body for each key and value in an object."
canonical_url: "https://docs.vettero.com/build/workflows/blocks/loops/for-in"
---
# For In

> Run the body for each key and value in an object.

<block-meta block="Yes" channels="Any" folder="basic/loops" group="Loops" groupTo="/build/workflows/blocks/loops" icon="i-lucide-braces" pipe="Value" scope="Any" tool="No" type="loop.for-in">



</block-meta>

**For In** walks the keys of an **object** and runs the **callback** body once per key. After the last key, the main path continues and the pipe holds every value the body **return**ed.

Use [For Of](https://docs.vettero.com/build/workflows/blocks/loops/for-of) for a list of items. Use [For](https://docs.vettero.com/build/workflows/blocks/loops/for) for a numeric range.

## Configure

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

<tbody>
  <tr>
    <td>
      <strong>
        Object
      </strong>
    </td>
    
    <td>
      Context path to the object (<code>
        args.*
      </code>
      
      , <code>
        pipe.*
      </code>
      
      , named variables). Must be a plain object, not a list
    </td>
  </tr>
</tbody>
</table>

The **Callback** outlet must be connected to a [Lambda](https://docs.vettero.com/build/workflows/blocks/module/lambda) block. If it is not connected, the run fails.

## 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 loop finishes (main path, same scope)
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Callback
      </strong>
    </td>
    
    <td>
      <strong>
        New callback scope
      </strong>
      
       for each key. Connect to <a href="https://docs.vettero.com/build/workflows/blocks/module/lambda">
        Lambda
      </a>
    </td>
  </tr>
</tbody>
</table>

Inside the body (after Lambda), use:

<table>
<thead>
  <tr>
    <th>
      Path
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        args.index
      </code>
    </td>
    
    <td>
      Zero-based iteration count
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        args.key
      </code>
    </td>
    
    <td>
      Current key (text)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        args.value
      </code>
    </td>
    
    <td>
      Value at that key
    </td>
  </tr>
</tbody>
</table>

End the body with a **return**. That returns from this callback, not from the whole workflow. The value is stored for this key. [Continue](https://docs.vettero.com/build/workflows/blocks/loops/continue) skips the rest of this key. [Break](https://docs.vettero.com/build/workflows/blocks/loops/break) stops remaining keys. An unconnected **Out** ends the main path after the loop.

## Pipe schema

The next block on the main path 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>
      Results
    </td>
    
    <td>
      list
    </td>
    
    <td>
      Values <strong>
        return
      </strong>
      
      ed for each key, in key order
    </td>
  </tr>
</tbody>
</table>

## Use case

- Map each field on a payload object (normalize, copy, or send one notification per key).
- After an API or object-building step, walk the result keys without converting to a list first.
- Skip a key with [Continue](https://docs.vettero.com/build/workflows/blocks/loops/continue), or stop remaining keys with [Break](https://docs.vettero.com/build/workflows/blocks/loops/break) when a key matches a [condition](https://docs.vettero.com/build/workflows/blocks/condition).

<block-page-nav>



</block-page-nav>


## Sitemap

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