I have changed a few things inside the function but the logic is the same still. Now, give an error in the compiler. I am USING TRUFFLE with VSC.
Former function:
function remove(uint ind) internal returns(address[]) {
delete addressStorage[ind];
for (uint j = ind; j<addressStorage.length;j++) {
if (j==addressStorage.length-1) {
break;
}else {
addressStorage[j] = addressStorage[j+1];
}
}
addressStorage.length--;
return addressStorage;
}
Actual:
function remove(uint ind, address[] array) internal returns(address[]) {
delete array[ind];
for (uint j = ind; j<array.length;j++) {
if (j==array.length-1) {
break;
}else {
array[j] = array[j+1];
}
}
array.length--;
return array;
}
Getting:
TypeError: Expression has to be an lvalue. array.length--; ^----------^
Any ideas? Thanks!