summaryrefslogtreecommitdiff
path: root/examples/break_next.fy
AgeCommit message (Collapse)Author
2026-02-19Add assert checks to break/next and loop/do examplesPaul Buetow
Replace bare say statements with assert expected == say value; so that each example self-verifies its output at runtime — matching the convention used in expressions.fy and types.fy. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19Implement break and next for while/until loopsPaul Buetow
TT_BREAK and TT_NEXT were already tokenised; this wires them up: - _program(): guard statement loop with ct == CONTROL_NONE so a break/next flag set inside a loop body stops block execution and propagates upward - _control(): add TT_BREAK and TT_NEXT cases that set CONTROL_BREAK / CONTROL_NEXT on p_interpret->ct and return immediately - while/until loop: replace the commented-out switch with active if/else logic that clears the flag and either stops iteration (break) or lets the loop re-evaluate its condition (next) Add examples/break_next.fy to exercise both keywords in while and until loops; expected output: 5 / 12 / 7. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>