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
Python Version (output of python --version): 3.10.0
What's your issue about?
When iterating through an array of addresses, I have to append to another array the ones already processed.
When trying to append to that array I get the compilation error Cannot modify loop variable
It works if I don't iterate through the addresses array, but use indices to do so instead.
@externaldef foo():
remainingToRepay: uint256=0
alreadyDone: DynArray[address, 10] = []
_assets: DynArray[address, 10] = []
for a: address in _assets:
if remainingToRepay ==0:
breakifnot a in alreadyDone:
continue
alreadyDone.append(a)
works with:
for i: uint256 in range(len(_asserts), bound=MAX_ASSETS):
a: address= _assets[i]
if remainingToRepay ==0:
breakifnot a in alreadyDone:
continue
alreadyDone.append(a)
The text was updated successfully, but these errors were encountered:
Version Information
vyper --version
): 0.4.0python --version
): 3.10.0What's your issue about?
When iterating through an array of addresses, I have to append to another array the ones already processed.
When trying to append to that array I get the compilation error
Cannot modify loop variable
It works if I don't iterate through the addresses array, but use indices to do so instead.
works with:
The text was updated successfully, but these errors were encountered: