Skip to content

Instantly share code, notes, and snippets.

View 0xheartcode's full-sized avatar
:shipit:
pong mode ☀️

0xheartcode 0xheartcode

:shipit:
pong mode ☀️
View GitHub Profile
function findPositionInArrayForLoop(uint _item, uint[] memory _array) pure internal returns (uint i) { // requirements should come before.
uint[] memory tmpArray = _array;
uint arrayLength = tmpArray.length;
for (i = 0; i < arrayLength;) {
if (tmpArray[i] != _item) {
unchecked {
i++;
}