How to properly delete the first element in an array?

by user3332558   Last Updated December 06, 2018 14:28 PM

Is it possible to delete the first element of an array without shifting all elements later?

My guess is that I can remember the index of the 'current first element', like so:

uint[] public myArray;
uint firstElement;
delete myArray[firstElement];

but, is there a convention or something built in for this?

Tags : solidity arrays

Related Questions

How to copy/assign an array via for loop

Updated July 02, 2017 23:28 PM

How to delete element of array, without index?

Updated August 09, 2017 17:28 PM

Is there a maximum array size in Solidity?

Updated August 10, 2017 08:28 AM

Delete an element from 2D array Solidity

Updated January 16, 2018 18:28 PM