You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@public
def foo(x:num):
p = 0
for i in range(3):
p += i
for i in range(4):
p += i
@public
def foo(x:num):
p = 0
for i in range(3):
p += i
for i in [1, 2, 3, 4]:
p += i
The compiler accepts the first program but rejects the second program.
How can it be fixed?
I'm not sure whether this behavior is intended or not. In python, it accepts both program. In my opinion, at least it should both accepts OR both rejects the program OR document this behavior properly.
Cute Animal Picture
The text was updated successfully, but these errors were encountered:
@jacqueswww you implemented the i in list feature right? Is i implemented as a variable in the calling scope? It should only exist in the for loop scope (i.e. destroyed after usage)
What's your issue about?
There are two programs:
The compiler accepts the first program but rejects the second program.
How can it be fixed?
I'm not sure whether this behavior is intended or not. In python, it accepts both program. In my opinion, at least it should both accepts OR both rejects the program OR document this behavior properly.
Cute Animal Picture
The text was updated successfully, but these errors were encountered: