005 grid read outside a write block

✓ Passing This code compiles and runs correctly.

Code

input.k

Actual

under-loop guard sees the write
top-level guard ok
cells[1].on reads 2
sum 12

Expected output

✓ Zig✓ JavaScript
under-loop guard sees the write
top-level guard ok
cells[1].on reads 2
sum 12

Flows

flow ~new click a branch to expand · @labels scroll to their anchor
new (expr: cells, size: 8, source: on: 0[i64])
flow ~new click a branch to expand · @labels scroll to their anchor
new (expr: acc, source: n: 0[i64])
flow ~for click a branch to expand · @labels scroll to their anchor
for (0..4)
flow ~if click a branch to expand · @labels scroll to their anchor
if (cells[2].on == 4)
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "cells[1].on reads {{ cells[1].on:d }}")
flow ~sweep click a branch to expand · @labels scroll to their anchor
sweep (expr: cells)
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "sum {{ acc.n:d }}")

Test Configuration

MUST_RUN