From e5dfad1e35e7bd9ccc6129f527706891a5bc1fd9 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Wed, 15 Jan 2025 10:28:35 +0100 Subject: [PATCH] better switch --- calc.go | 4 +--- interpreter.go | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/calc.go b/calc.go index c108af9..433f3b2 100644 --- a/calc.go +++ b/calc.go @@ -370,9 +370,7 @@ func (c *Calc) EvalItem(item string) error { } switch item { - case "?": - fallthrough - case "help": + case "?", "help": c.PrintHelp() default: diff --git a/interpreter.go b/interpreter.go index 87e948b..8fb3bb3 100644 --- a/interpreter.go +++ b/interpreter.go @@ -116,9 +116,7 @@ func (i *Interpreter) CallLuaFunc(funcname string, items []float64) (float64, er funcname, LuaFuncs[funcname].numargs)) switch LuaFuncs[funcname].numargs { - case 0: - fallthrough - case 1: + case 0, 1: // 1 arg variant if err := LuaInterpreter.CallByParam(lua.P{ Fn: LuaInterpreter.GetGlobal(funcname),