Skip to content

Conversation

@wolfv
Copy link
Member

@wolfv wolfv commented Nov 11, 2025

Implement break and continue builtin commands to provide loop control flow:

  • Add Break and LoopContinue variants to ExecuteResult enum to signal loop control flow separately from normal execution and exit
  • Create break and continue builtin commands that return the appropriate ExecuteResult variants
  • Update for, while, and until loop execution to handle Break (exit loop) and LoopContinue (skip to next iteration) results
  • Propagate loop control flow through all command execution paths (subshells, if statements, case statements, pipelines, etc.)
  • Add comprehensive tests for break and continue in for loops, including nested loops

All existing tests pass. The implementation follows bash semantics where:

  • break exits the innermost enclosing loop
  • continue skips to the next iteration of the innermost enclosing loop
  • Both commands outside of loops behave as no-ops (return 0)

claude and others added 2 commits November 11, 2025 07:00
Implement break and continue builtin commands to provide loop control flow:

- Add Break and LoopContinue variants to ExecuteResult enum to signal
  loop control flow separately from normal execution and exit
- Create break and continue builtin commands that return the appropriate
  ExecuteResult variants
- Update for, while, and until loop execution to handle Break (exit loop)
  and LoopContinue (skip to next iteration) results
- Propagate loop control flow through all command execution paths
  (subshells, if statements, case statements, pipelines, etc.)
- Add comprehensive tests for break and continue in for loops,
  including nested loops

All existing tests pass. The implementation follows bash semantics where:
- break exits the innermost enclosing loop
- continue skips to the next iteration of the innermost enclosing loop
- Both commands outside of loops behave as no-ops (return 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants