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.
@external
def foo():
remainingToRepay: uint256 = 0
alreadyDone: DynArray[address, 10] = []
_assets: DynArray[address, 10] = []
for a: address in _assets:
if remainingToRepay == 0:
break
if not 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:
break
if not a in alreadyDone:
continue
alreadyDone.append(a)
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: