From a2a0293d4f1f488e92b11db7b85f28f294384131 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 23 Mar 2020 04:46:24 +0000 Subject: 47296 (+ unposted additional tests and comments): 'repeat' loops: Let the repeat count use $?. It's an arithmetic expression. --- Src/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Src/loop.c') diff --git a/Src/loop.c b/Src/loop.c index f13c8c4a9..41b2e5627 100644 --- a/Src/loop.c +++ b/Src/loop.c @@ -497,7 +497,6 @@ execrepeat(Estate state, UNUSED(int do_exec)) end = state->pc + WC_REPEAT_SKIP(code); - lastval = 0; tmp = ecgetstr(state, EC_DUPTOK, &htok); if (htok) { singsub(&tmp); @@ -506,6 +505,7 @@ execrepeat(Estate state, UNUSED(int do_exec)) count = mathevali(tmp); if (errflag) return 1; + lastval = 0; /* used when the repeat count is zero */ pushheap(); cmdpush(CS_REPEAT); loops++; -- cgit 1.4.1