LoopFlow
Tutorial Workshop Keywords ๐ŸŽฎ LoopFlow Lab
Keywords / for each

for each

Run a template once per item. Structure

Syntax

for each <var> in "<file>":
  run "<template.loop>"

What it does

Dynamic fan-out: read a plan file (discovered at planning time) and run a template loop once per item โ€” each item's text becomes that run's context. If an item's checklist fails, the flow pauses and asks: continue or stop?

Examples

flow "deliver":
  for each item in "plan.yaml":
    run "item-template.loop"
examples/foreach/deliver.loop
# plan.yaml โ€” .yaml list (or .md: each "## " section is one item)
items:
  - title: Parse the uploaded CSV into rows
  - title: Validate rows against the schema
the source file

How it runs

๐Ÿ“„ plan.yamlthe work list item 1 item 2 item 3 โ€ฆ โ–ถ item-template.loop โ–ถ item-template.loop โ–ถ item-template.loop same template, once per item โ€” if one fails, it pauses and asks: continue or stop?
for each is dynamic fan-out: a planning step discovers the items, then the same template runs once per item.

Related