You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> [1,2,3] | each { |x|
::: if $x == 2 {
::: continue
::: }
::: print -e $x
::: }
1
3
Error: nu::shell::eval_block_with_input
× Eval block failed with pipeline input
╭─[entry #1:1:1]
1 │ [1,2,3] | each { |x|
· ┬
· ╰── source value
2 │ if $x == 2 {
╰────
Error:
× Continue used outside of loop
╭─[entry #1:2:1]
2 │ if $x == 2 {
3 │ continue
· ────┬───
· ╰── used outside of loop
4 │ }
╰────
13 is printed as expected, and then the script also fails on continue. So it's like continue worked... but didn't.
How to reproduce
See above
Expected behavior
Either not work at all (don't run the cycle) and fail-fast on detecting continue in an invalid location, or just work normally and don't error out.
Or, if this thing cannot be statically checked (but Nu does static checking according to docs), I would expect it to print 1, and then fail on continue. But it gets to 3! Magic.
Activity
sophiajt commentedon Apr 14, 2023
Looks like
eachdoesn't supportcontinue, yet. In theory, you can add it whereeachsupportsbreaknow.Apply `continue` to `each` (#8889)
Apply `continue` to `each` (nushell#8889)
amalagaura commentedon May 23, 2025
I am running
0.104.0and this is still throwing an error on the test case in the PR. I am confused because this PR shows merged: