Skip to content

Commit b336459

Browse files
committed
Fix break from remove-each
Reported by MichaT from altme. This is what the actual result: >> remove-each n s: [ 1 2 3 4] [ print n if n = 2 [ break] true ] s 1 2 == [3 4] This is what's expected: >> remove-each n s: [ 1 2 3 4] [ print n if n = 2 [ break] true ] s 1 2 == [2 3 4] Fix CC#2192
1 parent 63115b1 commit b336459

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/n-loop.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,10 @@
418418
ds = Do_Blk(body, 0);
419419

420420
if (THROWN(ds)) {
421-
if ((err = Check_Error(ds)) >= 0) break;
421+
if ((err = Check_Error(ds)) >= 0) {
422+
index = rindex;
423+
break;
424+
}
422425
// else CONTINUE:
423426
if (mode == 1) SET_FALSE(ds); // keep the value (for mode == 1)
424427
} else {

0 commit comments

Comments
 (0)