From 449fc06b72adf56d3b960310dc9e012145ad9ae4 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sun, 10 Apr 2022 01:50:57 -0400 Subject: Tweak how continue and break perform --- src/texec/eval.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/texec') diff --git a/src/texec/eval.go b/src/texec/eval.go index 510805e..40e2523 100644 --- a/src/texec/eval.go +++ b/src/texec/eval.go @@ -1103,25 +1103,25 @@ func evalCF(v tparse.Node, ctx *VarMap) (bool, TVariable, int) { } return true, null, 0 case "break": - brk := 1 + brk := 0 if len(v.Sub[i].Sub) > 0 { brk = getIntLiteral(v.Sub[i].Sub[0]) } if !loop { - return false, null, brk + return false, null, brk + 1 } - return false, null, brk - 1 + return false, null, brk case "continue": - cont := 1 + cont := 0 if len(v.Sub[i].Sub) > 0 { cont = getIntLiteral(v.Sub[i].Sub[0]) } if !loop { - return false, null, -cont - } else if cont == 1 { + return false, null, -(cont + 1) + } else if cont == 0 { goto CONCF } - return false, null, 1 - cont + return false, null, -cont } } -- cgit v1.2.3