2

I was working with arrays in my contract and I came across the fact that I'm deleting the middle element from an array and because I don't want to ruin the order I don't shift the last element to the deleted one. I also don't want to shift all elements because it might take more gas to do the transaction. So how does this affect my contract, in what sense? Also, will it be more expensive to have a mapping for indexing elements of an array or a having a for loop(up to 20-30 elements)? Any help appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.