A loop over a list that can stop at the first element a condition holds for — the graph's list.FirstOrDefault(x => …).
Today finding an element by one of its fields takes Count → Repeat → Item at → Expand → Equals → Branch, and the loop runs to the end even after the match.
Node For each (flow, next to Repeat)
Inputs
exec
list
break (boolean, default false)
Outputs
body (exec): runs once per element
item: the element of the round
index: its position
stopped (boolean): whether break ended the loop
done (exec): after the loop
Rules
break is read anew before every round, after item and index are set. So a condition built on item (e.g. Expand(item).Name == "Test") asks about the element at hand. This is the predicate.
Once break is true, the loop ends there: that round's body does not run, and done sees that round's item and index with stopped = true.
Without a break, done sees no item, index -1 and stopped false (the "OrDefault").
An empty list goes straight to done.
Every round reads its data inputs anew, like Repeat, so a variable the body changes is seen by the next round's break.
A loop over a list that can stop at the first element a condition holds for — the graph's `list.FirstOrDefault(x => …)`.
Today finding an element by one of its fields takes `Count` → `Repeat` → `Item at` → `Expand` → `Equals` → `Branch`, and the loop runs to the end even after the match.
## Node `For each` (flow, next to `Repeat`)
**Inputs**
- `exec`
- `list`
- `break` (boolean, default false)
**Outputs**
- `body` (exec): runs once per element
- `item`: the element of the round
- `index`: its position
- `stopped` (boolean): whether `break` ended the loop
- `done` (exec): after the loop
**Rules**
- `break` is read anew **before every round**, after `item` and `index` are set. So a condition built on `item` (e.g. `Expand(item).Name == "Test"`) asks about the element at hand. This is the predicate.
- Once `break` is true, the loop ends there: that round's `body` does not run, and `done` sees that round's `item` and `index` with `stopped` = true.
- Without a break, `done` sees no item, `index` -1 and `stopped` false (the "OrDefault").
- An empty list goes straight to `done`.
- Every round reads its data inputs anew, like `Repeat`, so a variable the body changes is seen by the next round's `break`.
For each (flow): inputs exec, list, break; outputs body, item, index, stopped, done.
break is read anew before every round, after item and index are set. Once it is true the loop ends there: that round's body does not run, done sees the match with stopped true.
Without a match done sees no item, index -1 and stopped false (the "OrDefault").
FirstOrDefault(x => x.Name == "Gold"): item → Expand (Name) → Equals "Gold" → break, and a Branch on stopped after done.
Like Repeat, every round reads its data inputs anew, so a variable the body changes counts for the next round's break.
Tests: gate 2623 tests green, e2e 1-6 269 checks (new 6z-iv, 2 checks). Counter-checks: without the break check 2 unit tests fail, with break not read over its edge 6z-iv fails.
Done in cb8a2d0.
- **For each** (flow): inputs `exec`, `list`, `break`; outputs `body`, `item`, `index`, `stopped`, `done`.
- `break` is read anew before every round, after `item` and `index` are set. Once it is true the loop ends there: that round's `body` does not run, `done` sees the match with `stopped` true.
- Without a match `done` sees no item, `index` -1 and `stopped` false (the "OrDefault").
- `FirstOrDefault(x => x.Name == "Gold")`: `item` → `Expand` (Name) → `Equals "Gold"` → `break`, and a `Branch` on `stopped` after `done`.
- Like `Repeat`, every round reads its data inputs anew, so a variable the body changes counts for the next round's break.
Tests: gate 2623 tests green, e2e 1-6 269 checks (new 6z-iv, 2 checks). Counter-checks: without the break check 2 unit tests fail, with `break` not read over its edge 6z-iv fails.
Wiki: [Behaviors](https://git.nockal.com/meleki/game-maker/wiki/Behaviors).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
A loop over a list that can stop at the first element a condition holds for — the graph's
list.FirstOrDefault(x => …).Today finding an element by one of its fields takes
Count→Repeat→Item at→Expand→Equals→Branch, and the loop runs to the end even after the match.Node
For each(flow, next toRepeat)Inputs
execlistbreak(boolean, default false)Outputs
body(exec): runs once per elementitem: the element of the roundindex: its positionstopped(boolean): whetherbreakended the loopdone(exec): after the loopRules
breakis read anew before every round, afteritemandindexare set. So a condition built onitem(e.g.Expand(item).Name == "Test") asks about the element at hand. This is the predicate.breakis true, the loop ends there: that round'sbodydoes not run, anddonesees that round'sitemandindexwithstopped= true.donesees no item,index-1 andstoppedfalse (the "OrDefault").done.Repeat, so a variable the body changes is seen by the next round'sbreak.Done in
cb8a2d0.exec,list,break; outputsbody,item,index,stopped,done.breakis read anew before every round, afteritemandindexare set. Once it is true the loop ends there: that round'sbodydoes not run,donesees the match withstoppedtrue.donesees no item,index-1 andstoppedfalse (the "OrDefault").FirstOrDefault(x => x.Name == "Gold"):item→Expand(Name) →Equals "Gold"→break, and aBranchonstoppedafterdone.Repeat, every round reads its data inputs anew, so a variable the body changes counts for the next round's break.Tests: gate 2623 tests green, e2e 1-6 269 checks (new 6z-iv, 2 checks). Counter-checks: without the break check 2 unit tests fail, with
breaknot read over its edge 6z-iv fails.Wiki: Behaviors.