From 68168d9feffd439a2d004ff64f91e0f23fa3d5d5 Mon Sep 17 00:00:00 2001 From: George Marchment <georgemarchment@yahoo.fr> Date: Tue, 18 Mar 2025 14:30:51 +0100 Subject: [PATCH] Fix small ternary operation bug --- src/code_.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code_.py b/src/code_.py index d4d4b4b..7a9dd14 100644 --- a/src/code_.py +++ b/src/code_.py @@ -73,7 +73,7 @@ class Code: exp1, exp2 = match.group(4).strip(), match.group(5).strip() old = match.group(0) new = f"if ({condition}) {{\n{def_variable} {variable} = {exp1}\n}}\n" - new += f"else {{\n{def_variable} {variable} = {exp2}\n}}\n\n" + new += f"if (!({condition})) {{\n{def_variable} {variable} = {exp2}\n}}\n\n" #else {{\n{variable} = {exp2}\n}}\n" #Here we check that it's worked correctly -> that we have done a good parsing if(get_parenthese_count(condition)==0 and get_parenthese_count(exp1)==0 and get_parenthese_count(exp2)==0 and get_curly_count(condition)==0 and get_curly_count(exp1)==0 and get_curly_count(exp2)==0): -- GitLab