diff --git a/lambdaV.py b/lambdaV.py index ff56d3b..ce55c1a 100644 --- a/lambdaV.py +++ b/lambdaV.py @@ -173,12 +173,28 @@ def command_take(): return "" def command_repeat(number, parsed_code): + for i in range(number): + result = run_code(parsed_code) + if not result=="": + return result return "" def command_while(parsed_condition, parsed_code): + while parsed_condition[0](parsed_condition[1]): + result = run_code(parsed_code) + if not result=="": + return result return "" def command_if(parsed_condition, parsed_then_code, parsed_else_code): + if parsed_condition[0](parsed_condition[1]): + result = run_code(parsed_then_code) + if not result=="": + return result + elif not parsed_else_code==None: + result = run_code(parsed_else_code) + if not result=="": + return result return ""