Scenario: for (from, until, through, step)

Numeric range loops

specified graph-owned fixture
Open in Inspector ->
source src://controls/for-range.html rendered rendered://public/controls/for-range.html until-exclusive and through-inclusive bounds, step, countdown, fractional values, index scope specified
source src://controls/for-range.html rendered rendered://public/controls/for-range.html corpus public://_hypermake/testing/latest.json
For source.html
<for until="{{ rowCount }}" key="n">
  {{ index }}: {{ n }}
</for>

<for from="{{ 2 }}" through="{{ 10 }}"
     step="{{ 4 }}" key="v" index="slot">
  {{ slot }}: {{ v }}
</for>

<for from="{{ 3 }}" until="{{ 0 }}"
     step="{{ -1 }}" key="down">
  {{ down }}
</for>
src://controls/for-range.html
Range expectation

until exclusive bound 0 1 2

through inclusive bound with step 4 2 6 10

step -1 countdown 3 2 1

step 0.5 fractional values 0 0.5 1

What this tests

  • for generates its collection from numeric bounds, not a data read.
  • until stops before the bound; through includes it; exactly one of the two is legal.
  • from defaults to 0, step defaults to 1, index defaults to index; a negative step counts down.
  • Loop key and index stay scoped to their own for occurrence.

Expected behavior

  • Whole-number values render as integers (0, not 0.0); fractional steps keep their fractions.
  • Bound expressions must produce numbers (for.non_numeric_bound), step must be nonzero (for.zero_step), and ranges are capped at 100000 iterations (for.range_too_large).
  • Item identity is the zero-based index, so bound edits refresh the loop frame in place.

Effect policy

policy refresh_control_frame

scope cache://hypermake/lzr/tape-ledgers/rendered/public/controls/for-range.tape-ledger.json

Live range targets

until-exclusive 0: 0

until-exclusive 1: 1

until-exclusive 2: 2

through-inclusive 0: 2

through-inclusive 1: 6

through-inclusive 2: 10

countdown: 3 2 1

fractional: 0 0.5 1