When i add element into array, and after adding, i don't know index of this element. How to delete element in this case? I can find index, using while, but i think it's very bad thing, because its cause many additional code in contract.
uint[] messageIds;
...
function a(uint _id) {
messageIds.push(_id);
}
May be there is other solution?