We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1d0547 commit c852cf4Copy full SHA for c852cf4
interpreter.py
@@ -41,9 +41,8 @@ def visitElse(self, ctx: MyParser.ElseContext):
41
def visitForLoop(self, ctx: MyParser.ForLoopContext):
42
a, b = self.visit(ctx.range_())
43
variable = ctx.id_().getText()
44
- while a <= b:
45
- self.memory_stack.put(variable, Int(a))
46
- a = a + 1 # to increment enumerateor and disregard changes inside the loop
+ for i in range(a, b + 1):
+ self.memory_stack.put(variable, Int(i))
47
try:
48
self.visit(ctx.statement())
49
except Continue:
0 commit comments